33 lines
945 B
TypeScript
33 lines
945 B
TypeScript
import { describe, expect, it, beforeEach } from "vitest";
|
|
import {
|
|
defaultCopModConfig,
|
|
loadCopModConfig,
|
|
saveCopModConfig,
|
|
CLEANING_COPMOD_STORAGE_KEY,
|
|
} from "./cleaningSettings";
|
|
|
|
describe("cleaningSettings", () => {
|
|
beforeEach(() => {
|
|
localStorage.removeItem(CLEANING_COPMOD_STORAGE_KEY);
|
|
});
|
|
|
|
it("returns defaults when empty", () => {
|
|
const cfg = loadCopModConfig();
|
|
expect(cfg.moderadora_by_year["2024"]).toEqual([4500, 18200, 47700]);
|
|
});
|
|
|
|
it("persists and reloads custom years", () => {
|
|
saveCopModConfig({
|
|
moderadora_by_year: { "2030": [1000, 2000] },
|
|
});
|
|
const cfg = loadCopModConfig();
|
|
expect(cfg.moderadora_by_year).toEqual({ "2030": [1000, 2000] });
|
|
});
|
|
|
|
it("defaultCopModConfig is a deep copy", () => {
|
|
const a = defaultCopModConfig();
|
|
a.moderadora_by_year["2024"].push(999);
|
|
expect(defaultCopModConfig().moderadora_by_year["2024"]).not.toContain(999);
|
|
});
|
|
});
|