27 lines
1 KiB
TypeScript
27 lines
1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { getAssociationCommuneLabel, getAssociationCommuneVariants, normalizeAssociationCommune } from "@shared/associationCommunes";
|
|
|
|
describe("association communes helpers", () => {
|
|
it("returns expected variants for saint-elie", () => {
|
|
const variants = getAssociationCommuneVariants("saint_elie");
|
|
|
|
expect(variants).toContain("Saint-Élie");
|
|
expect(variants).toContain("Saint Elie");
|
|
expect(variants).toContain("ST ELIE");
|
|
});
|
|
|
|
it("returns no variants for all", () => {
|
|
expect(getAssociationCommuneVariants("all")).toEqual([]);
|
|
});
|
|
|
|
it("returns labels for filters", () => {
|
|
expect(getAssociationCommuneLabel("kourou")).toBe("Kourou");
|
|
expect(getAssociationCommuneLabel("saint_elie")).toBe("Saint-Élie");
|
|
});
|
|
|
|
it("normalizes commune variants", () => {
|
|
expect(normalizeAssociationCommune("ST ELIE")).toBe("saint_elie");
|
|
expect(normalizeAssociationCommune("Saint-Elie")).toBe("saint_elie");
|
|
expect(normalizeAssociationCommune("Kourou")).toBe("kourou");
|
|
});
|
|
});
|