Files
buzz/desktop/src/features/settings/sidebarUpdateCardVisibility.test.mjs
Will Pfleger deed64a14f fix(desktop): require user action before applying updates (#1820)
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Co-authored-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@sprout-oss.stage.blox.sqprod.co>
2026-07-13 16:13:20 -04:00

31 lines
1.4 KiB
JavaScript

import assert from "node:assert/strict";
import test from "node:test";
import { shouldShowSidebarUpdateCard } from "./sidebarUpdateCardVisibility.ts";
test("shows the card for states that require user action or feedback", () => {
assert.equal(shouldShowSidebarUpdateCard({ state: "ready" }), true);
assert.equal(shouldShowSidebarUpdateCard({ state: "installing" }), true);
assert.equal(shouldShowSidebarUpdateCard({ state: "manual-required" }), true);
});
test("hides the card for states with nothing actionable to show", () => {
assert.equal(shouldShowSidebarUpdateCard({ state: "idle" }), false);
assert.equal(shouldShowSidebarUpdateCard({ state: "checking" }), false);
assert.equal(shouldShowSidebarUpdateCard({ state: "up-to-date" }), false);
assert.equal(shouldShowSidebarUpdateCard({ state: "unavailable" }), false);
assert.equal(shouldShowSidebarUpdateCard({ state: "available" }), false);
assert.equal(shouldShowSidebarUpdateCard({ state: "downloading" }), false);
});
// Pre-existing behavior, unchanged by this fix: an install failure hides the
// card rather than surfacing an error state in the sidebar. The background
// check will retry and can re-show "available"/"ready" on its own schedule,
// so this is left as-is rather than scoped into the installing-state fix.
test("hides the card on error, matching pre-existing behavior", () => {
assert.equal(
shouldShowSidebarUpdateCard({ state: "error", message: "boom" }),
false,
);
});