Files
HealthLog/src/lib/settings/__tests__/preview-features.test.ts
T
Marc-André Bombeck 93198017d6 feat(settings): keep list order and preview opt-ins on the server
Add per-user columns for the labs, illness and checkups list presentation
and for preview-feature opt-ins, each with a GET plus a preserve-when-absent
write under /api/settings. The list hook now reads and writes the server
value and carries a browser-stored order up once when the server holds
none, so an existing arrangement follows the person to every device instead
of resetting.
2026-10-21 19:11:23 +02:00

27 lines
750 B
TypeScript

import { describe, expect, it } from "vitest";
import {
DEFAULT_PREVIEW_FEATURES,
resolvePreviewFeatures,
} from "../preview-features";
describe("resolvePreviewFeatures", () => {
it("is all off by default", () => {
expect(DEFAULT_PREVIEW_FEATURES).toEqual({ topics: false });
expect(resolvePreviewFeatures(null)).toEqual({ topics: false });
});
it("reads a flag only on an explicit true", () => {
expect(resolvePreviewFeatures({ topics: true })).toEqual({ topics: true });
expect(resolvePreviewFeatures({ topics: "true" })).toEqual({
topics: false,
});
});
it("drops unknown keys", () => {
expect(resolvePreviewFeatures({ topics: true, retired: true })).toEqual({
topics: true,
});
});
});