mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 13:10:56 +00:00
28 lines
888 B
TypeScript
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();
|
|
});
|
|
});
|