mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 06:52:04 +00:00
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.
27 lines
750 B
TypeScript
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,
|
|
});
|
|
});
|
|
});
|