34 lines
982 B
TypeScript
34 lines
982 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import {
|
|
DEFAULT_DASHBOARD_SECTION_ORDER,
|
|
normalizeDashboardSectionOrder,
|
|
normalizeDashboardSectionVisibility,
|
|
} from "@/lib/dashboard-sections";
|
|
|
|
describe("dashboard sections", () => {
|
|
it("keeps stored section order and appends missing defaults", () => {
|
|
expect(normalizeDashboardSectionOrder(["forecast", "weatherBrief", "unknown"])).toEqual([
|
|
"forecast",
|
|
"weatherBrief",
|
|
"warnings",
|
|
"favorites",
|
|
"featuredStations",
|
|
]);
|
|
});
|
|
|
|
it("falls back to the default order for invalid values", () => {
|
|
expect(normalizeDashboardSectionOrder(null)).toEqual(DEFAULT_DASHBOARD_SECTION_ORDER);
|
|
});
|
|
|
|
it("normalizes visibility for older stored preferences", () => {
|
|
expect(normalizeDashboardSectionVisibility({ weatherBrief: false })).toEqual({
|
|
warnings: true,
|
|
weatherBrief: false,
|
|
forecast: true,
|
|
favorites: true,
|
|
featuredStations: false,
|
|
});
|
|
});
|
|
});
|