Files
edr-platform/packages/iam-seed/src/missing-settings.util.spec.ts
2026-07-27 08:42:27 +00:00

28 lines
888 B
TypeScript

import { missingSettings } from "./missing-settings.util";
const defaults = [
{ key: "primaryColor", displayName: "Primary Color", value: null },
{ key: "logoFileUrl", displayName: "Logo", value: null },
];
describe("missingSettings", () => {
it("returns every default when the owner has none", () => {
expect(missingSettings(defaults, new Set(), "org-1")).toHaveLength(2);
});
it("skips keys the owner has, but not the same key on another owner", () => {
const existing = new Set(["org-1:primaryColor"]);
expect(
missingSettings(defaults, existing, "org-1").map((s) => s.key),
).toEqual(["logoFileUrl"]);
expect(missingSettings(defaults, existing, "org-2")).toHaveLength(2);
});
it("drops nulls so the column default applies", () => {
expect(
missingSettings(defaults, new Set(), "org-1")[0].value,
).toBeUndefined();
});
});