test: close selected coverage gaps

This commit is contained in:
Federico Jaramillo Martinez
2026-07-03 21:40:36 +02:00
parent 8511604e83
commit 73b169a768
20 changed files with 1333 additions and 18 deletions
@@ -76,6 +76,17 @@ describe("recommendedCommand", () => {
expect(result).toEqual({ label: "Restart everything", command: "pi-web restart" });
});
it("recommends restart when the session daemon is stale", () => {
const result = recommendedCommand(status({
components: {
web: component(),
sessiond: component({ component: "sessiond", label: "Session daemon", stale: true }),
},
commands: { restart: "pi-web restart" },
}));
expect(result).toEqual({ label: "Restart everything", command: "pi-web restart" });
});
it("returns nothing when everything is current and available", () => {
expect(recommendedCommand(status({ commands: { restart: "pi-web restart" } }))).toBeUndefined();
});
@@ -243,6 +254,18 @@ describe("fallbackDockerStatus", () => {
expect(fallback?.messages[0]?.id).toBe("docker-status-compatibility");
});
it("creates Docker runtime commands without the development prefix", () => {
const fallback = fallbackDockerStatus({ dockerMode: "runtime" });
expect(fallback?.components.sessiond.installation).toEqual({ kind: "docker", dockerMode: "runtime" });
expect(fallback?.commands).toEqual({
update: "pi-web-docker update",
restart: "pi-web-docker restart",
restartWeb: "pi-web-docker restart-web",
restartSessiond: "pi-web-docker restart-sessiond",
status: "pi-web-docker status",
});
});
it("does not create a fallback without a Docker runtime hint", () => {
expect(fallbackDockerStatus({})).toBeUndefined();
});