diff --git a/src/cli/gateway-cli/register.option-collisions.test.ts b/src/cli/gateway-cli/register.option-collisions.test.ts index fd63c10dd4c..b033f149c4e 100644 --- a/src/cli/gateway-cli/register.option-collisions.test.ts +++ b/src/cli/gateway-cli/register.option-collisions.test.ts @@ -122,6 +122,14 @@ vi.mock("./discover.js", () => ({ renderBeaconLines: () => [], })); +function firstGatewayCall() { + return callGatewayCli.mock.calls[0] ?? []; +} + +function firstGatewayStatusCall() { + return gatewayStatusCommand.mock.calls[0] ?? []; +} + describe("gateway register option collisions", () => { let sharedProgram: Command = new Command(); @@ -146,7 +154,7 @@ describe("gateway register option collisions", () => { argv: ["gateway", "call", "health", "--token", "tok_call", "--json"], assert: () => { expect(callGatewayCli).toHaveBeenCalledTimes(1); - const [method, opts, params] = callGatewayCli.mock.calls.at(0) ?? []; + const [method, opts, params] = firstGatewayCall(); expect(method).toBe("health"); expect((opts as { token?: string } | undefined)?.token).toBe("tok_call"); expect(params).toEqual({}); @@ -157,7 +165,7 @@ describe("gateway register option collisions", () => { argv: ["gateway", "probe", "--token", "tok_probe", "--json"], assert: () => { expect(gatewayStatusCommand).toHaveBeenCalledTimes(1); - const [opts, runtime] = gatewayStatusCommand.mock.calls.at(0) ?? []; + const [opts, runtime] = firstGatewayStatusCall(); expect((opts as { token?: string } | undefined)?.token).toBe("tok_probe"); expect(runtime).toBe(defaultRuntime); },