@@ -34,6 +34,10 @@ vi.mock("../runtime.js", () => ({
|
34 | 34 | defaultRuntime: mocks.defaultRuntime, |
35 | 35 | })); |
36 | 36 | |
| 37 | +function firstCallOptions(mock: { mock: { calls: unknown[][] } }) { |
| 38 | +return mock.mock.calls[0]?.[0]; |
| 39 | +} |
| 40 | + |
37 | 41 | describe("update cli option collisions", () => { |
38 | 42 | beforeEach(() => { |
39 | 43 | updateCommand.mockClear(); |
@@ -52,7 +56,7 @@ describe("update cli option collisions", () => {
|
52 | 56 | argv: ["update", "status", "--json", "--timeout", "9"], |
53 | 57 | assert: () => { |
54 | 58 | expect(updateStatusCommand).toHaveBeenCalledTimes(1); |
55 | | -const [opts] = updateStatusCommand.mock.calls.at(0) ?? []; |
| 59 | +const opts = firstCallOptions(updateStatusCommand); |
56 | 60 | expect((opts as { json?: boolean; timeout?: string } | undefined)?.json).toBe(true); |
57 | 61 | expect((opts as { json?: boolean; timeout?: string } | undefined)?.timeout).toBe("9"); |
58 | 62 | }, |
@@ -62,7 +66,7 @@ describe("update cli option collisions", () => {
|
62 | 66 | argv: ["update", "wizard", "--timeout", "13"], |
63 | 67 | assert: () => { |
64 | 68 | expect(updateWizardCommand).toHaveBeenCalledTimes(1); |
65 | | -const [opts] = updateWizardCommand.mock.calls.at(0) ?? []; |
| 69 | +const opts = firstCallOptions(updateWizardCommand); |
66 | 70 | expect((opts as { timeout?: string } | undefined)?.timeout).toBe("13"); |
67 | 71 | }, |
68 | 72 | }, |
|