From e35bc01adedecf1dced057944031ce11706d6d99 Mon Sep 17 00:00:00 2001 From: Shakker Date: Tue, 12 May 2026 05:13:25 +0100 Subject: [PATCH] test: count cli command calls --- src/cli/daemon-cli.coverage.test.ts | 2 +- src/cli/daemon-cli/lifecycle.test.ts | 2 +- src/cli/program.force.test.ts | 2 +- src/cli/program/message/helpers.test.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cli/daemon-cli.coverage.test.ts b/src/cli/daemon-cli.coverage.test.ts index ba42fdd713d..5b3ef98a216 100644 --- a/src/cli/daemon-cli.coverage.test.ts +++ b/src/cli/daemon-cli.coverage.test.ts @@ -211,7 +211,7 @@ describe("daemon-cli coverage", () => { "ws://127.0.0.1:18789", ); expect(findExtraGatewayServices).not.toHaveBeenCalled(); - expect(inspectPortUsage).toHaveBeenCalled(); + expect(inspectPortUsage).toHaveBeenCalledTimes(1); }); it("derives probe URL from service args + env (json)", async () => { diff --git a/src/cli/daemon-cli/lifecycle.test.ts b/src/cli/daemon-cli/lifecycle.test.ts index cae9ca8e0a8..ebbd12bd388 100644 --- a/src/cli/daemon-cli/lifecycle.test.ts +++ b/src/cli/daemon-cli/lifecycle.test.ts @@ -304,7 +304,7 @@ describe("runDaemonRestart health checks", () => { await runDaemonRestart({ json: true, force: true }); expect(callGatewayCli).not.toHaveBeenCalled(); - expect(runServiceRestart).toHaveBeenCalled(); + expect(runServiceRestart).toHaveBeenCalledTimes(1); }); it("forwards --safe --skip-deferral as skipDeferral: true on the RPC", async () => { diff --git a/src/cli/program.force.test.ts b/src/cli/program.force.test.ts index 8440e058873..3a092b8add5 100644 --- a/src/cli/program.force.test.ts +++ b/src/cli/program.force.test.ts @@ -93,7 +93,7 @@ describe("gateway --force helpers", () => { const killed = forceFreePort(18789); - expect(execFileSync).toHaveBeenCalled(); + expect(execFileSync).toHaveBeenCalledTimes(1); expect(killMock).toHaveBeenCalledTimes(2); expect(killMock).toHaveBeenCalledWith(42, "SIGTERM"); expect(killMock).toHaveBeenCalledWith(99, "SIGTERM"); diff --git a/src/cli/program/message/helpers.test.ts b/src/cli/program/message/helpers.test.ts index 43782529757..6fef50d84d5 100644 --- a/src/cli/program/message/helpers.test.ts +++ b/src/cli/program/message/helpers.test.ts @@ -274,7 +274,7 @@ describe("runMessageAction", () => { scope: "configured-channels", onlyChannelIds: ["telegram"], }); - expect(messageCommandMock).toHaveBeenCalled(); + expect(messageCommandMock).toHaveBeenCalledTimes(1); }); it("loads configured channel plugins for mixed broadcast target prefixes", async () => {