


























@@ -122,6 +122,14 @@ vi.mock("./discover.js", () => ({
122122renderBeaconLines: () => [],
123123}));
124124125+function firstGatewayCall() {
126+return callGatewayCli.mock.calls[0] ?? [];
127+}
128+129+function firstGatewayStatusCall() {
130+return gatewayStatusCommand.mock.calls[0] ?? [];
131+}
132+125133describe("gateway register option collisions", () => {
126134let sharedProgram: Command = new Command();
127135@@ -146,7 +154,7 @@ describe("gateway register option collisions", () => {
146154argv: ["gateway", "call", "health", "--token", "tok_call", "--json"],
147155assert: () => {
148156expect(callGatewayCli).toHaveBeenCalledTimes(1);
149-const [method, opts, params] = callGatewayCli.mock.calls.at(0) ?? [];
157+const [method, opts, params] = firstGatewayCall();
150158expect(method).toBe("health");
151159expect((opts as { token?: string } | undefined)?.token).toBe("tok_call");
152160expect(params).toEqual({});
@@ -157,7 +165,7 @@ describe("gateway register option collisions", () => {
157165argv: ["gateway", "probe", "--token", "tok_probe", "--json"],
158166assert: () => {
159167expect(gatewayStatusCommand).toHaveBeenCalledTimes(1);
160-const [opts, runtime] = gatewayStatusCommand.mock.calls.at(0) ?? [];
168+const [opts, runtime] = firstGatewayStatusCall();
161169expect((opts as { token?: string } | undefined)?.token).toBe("tok_probe");
162170expect(runtime).toBe(defaultRuntime);
163171},
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。