mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-16 10:28:45 +00:00
test: dedupe gateway cli mock reads
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user