mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-26 13:55:13 +00:00
test: dedupe update cli mock reads
This commit is contained in:
@@ -34,6 +34,10 @@ vi.mock("../runtime.js", () => ({
|
||||
defaultRuntime: mocks.defaultRuntime,
|
||||
}));
|
||||
|
||||
function firstCallOptions(mock: { mock: { calls: unknown[][] } }) {
|
||||
return mock.mock.calls[0]?.[0];
|
||||
}
|
||||
|
||||
describe("update cli option collisions", () => {
|
||||
beforeEach(() => {
|
||||
updateCommand.mockClear();
|
||||
@@ -52,7 +56,7 @@ describe("update cli option collisions", () => {
|
||||
argv: ["update", "status", "--json", "--timeout", "9"],
|
||||
assert: () => {
|
||||
expect(updateStatusCommand).toHaveBeenCalledTimes(1);
|
||||
const [opts] = updateStatusCommand.mock.calls.at(0) ?? [];
|
||||
const opts = firstCallOptions(updateStatusCommand);
|
||||
expect((opts as { json?: boolean; timeout?: string } | undefined)?.json).toBe(true);
|
||||
expect((opts as { json?: boolean; timeout?: string } | undefined)?.timeout).toBe("9");
|
||||
},
|
||||
@@ -62,7 +66,7 @@ describe("update cli option collisions", () => {
|
||||
argv: ["update", "wizard", "--timeout", "13"],
|
||||
assert: () => {
|
||||
expect(updateWizardCommand).toHaveBeenCalledTimes(1);
|
||||
const [opts] = updateWizardCommand.mock.calls.at(0) ?? [];
|
||||
const opts = firstCallOptions(updateWizardCommand);
|
||||
expect((opts as { timeout?: string } | undefined)?.timeout).toBe("13");
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user