mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-06 19:56:45 +10:30
28 lines
935 B
TypeScript
28 lines
935 B
TypeScript
import { normalizeRemoteStatus } from "./remoteStatus";
|
|
|
|
describe("normalizeRemoteStatus", () => {
|
|
it("falls back to working defaults for missing or malformed data", () => {
|
|
const defaults = { off: false, message: null, disabledFeatures: [], sites: {} };
|
|
expect(normalizeRemoteStatus(null)).toEqual(defaults);
|
|
expect(
|
|
normalizeRemoteStatus({ off: "yes", message: 4, disabledFeatures: "page.news" }),
|
|
).toEqual(defaults);
|
|
});
|
|
|
|
it("keeps valid fields and drops non-string feature keys", () => {
|
|
expect(
|
|
normalizeRemoteStatus({
|
|
off: true,
|
|
message: "Back soon",
|
|
disabledFeatures: ["page.news", 1],
|
|
sites: { "Learn.School.edu.au": ["plugin.timetable-classmates", 2] },
|
|
}),
|
|
).toEqual({
|
|
off: true,
|
|
message: "Back soon",
|
|
disabledFeatures: ["page.news"],
|
|
sites: { "learn.school.edu.au": ["plugin.timetable-classmates"] },
|
|
});
|
|
});
|
|
});
|