Files
edr-platform/apps/edr-freight-web/portal/src/utils/documentSettingCode.test.ts
2026-08-12 07:12:04 +00:00

29 lines
931 B
TypeScript

import { describe, expect, it } from "vitest";
import { documentSettingCode } from "./documentSettingCode";
describe("documentSettingCode", () => {
it("resolves the nationality set", () => {
expect(documentSettingCode("ethiopian")).toBe(
"company_onboarding_documents_ethiopian",
);
expect(documentSettingCode("foreign")).toBe(
"company_onboarding_documents_foreign",
);
expect(documentSettingCode(null)).toBe(
"company_onboarding_documents_ethiopian",
);
});
it("replaces the nationality set for a co-operative", () => {
expect(documentSettingCode("ethiopian", true)).toBe(
"company_onboarding_documents_cooperative",
);
// A co-op is never foreign, but a stale flag must not fall back to the
// foreign set — the co-op answer wins.
expect(documentSettingCode("foreign", true)).toBe(
"company_onboarding_documents_cooperative",
);
});
});