fix: polish restart feedback + stabilize tests (#685) (thanks @carlulsoe)

This commit is contained in:
Peter Steinberger
2026-01-10 22:52:09 +01:00
parent f699dc3777
commit fa61699f9a
5 changed files with 30 additions and 3 deletions

View File

@@ -131,6 +131,33 @@ describe("update-cli", () => {
expect(runDaemonRestart).toHaveBeenCalled();
});
it("updateCommand skips success message when restart does not run", async () => {
const { runGatewayUpdate } = await import("../infra/update-runner.js");
const { runDaemonRestart } = await import("./daemon-cli.js");
const { defaultRuntime } = await import("../runtime.js");
const { updateCommand } = await import("./update-cli.js");
const mockResult: UpdateRunResult = {
status: "ok",
mode: "git",
steps: [],
durationMs: 100,
};
vi.mocked(runGatewayUpdate).mockResolvedValue(mockResult);
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("updateCommand validates timeout option", async () => {
const { defaultRuntime } = await import("../runtime.js");
const { updateCommand } = await import("./update-cli.js");