test: merge update cli restart behavior cases

This commit is contained in:
Peter Steinberger 2026-03-17 10:09:08 +00:00
parent e3d021163c
commit 58313fcd05

View File

@ -743,6 +743,21 @@ describe("update-cli", () => {
expect(runDaemonRestart).not.toHaveBeenCalled();
},
},
{
name: "skips success message when restart does not run",
run: async () => {
vi.mocked(runGatewayUpdate).mockResolvedValue(makeOkUpdateResult());
vi.mocked(runDaemonRestart).mockResolvedValue(false);
vi.mocked(defaultRuntime.log).mockClear();
await updateCommand({ restart: true });
},
assert: () => {
const logLines = vi.mocked(defaultRuntime.log).mock.calls.map((call) => String(call[0]));
expect(logLines.some((line) => line.includes("Daemon restarted successfully."))).toBe(
false,
);
},
},
] as const;
for (const testCase of cases) {
@ -879,17 +894,6 @@ describe("update-cli", () => {
}
});
it("updateCommand skips success message when restart does not run", async () => {
vi.mocked(runGatewayUpdate).mockResolvedValue(makeOkUpdateResult());
vi.mocked(runDaemonRestart).mockResolvedValue(false);
vi.mocked(defaultRuntime.log).mockClear();
await updateCommand({ restart: true });
const logLines = vi.mocked(defaultRuntime.log).mock.calls.map((call) => String(call[0]));
expect(logLines.some((line) => line.includes("Daemon restarted successfully."))).toBe(false);
});
it("validates update command invocation errors", async () => {
const cases = [
{