Files

26 lines
909 B
TypeScript
Raw Permalink Normal View History

2026-11-08 14:49:29 -05:00
import { describe, expect, test } from "bun:test";
import { readyToReload } from "../src/client/update.ts";
const safe = { updateReady: true, hidden: true, editing: false, busy: false };
describe("app update reload", () => {
test("reloads a hidden page when an update is ready and nothing is open", () => {
expect(readyToReload(safe)).toBe(true);
});
test("does not reload without an update", () => {
expect(readyToReload({ ...safe, updateReady: false })).toBe(false);
});
test("does not reload while the user looks at the page", () => {
expect(readyToReload({ ...safe, hidden: false })).toBe(false);
});
test("does not reload while the entry editor is open", () => {
expect(readyToReload({ ...safe, editing: true })).toBe(false);
});
test("does not reload while a save or import runs", () => {
expect(readyToReload({ ...safe, busy: true })).toBe(false);
});
});