|
| 1 | +import { describe, it, expect } from "vitest"; |
| 2 | +import { formatEmbalseDisplayName } from "./embalse-name.helper"; |
| 3 | + |
| 4 | +describe("formatEmbalseDisplayName", () => { |
| 5 | + it("flips comma-inverted El", () => { |
| 6 | + expect(formatEmbalseDisplayName("Atazar, El")).toBe("El Atazar"); |
| 7 | + expect(formatEmbalseDisplayName("Pardo, El")).toBe("El Pardo"); |
| 8 | + expect(formatEmbalseDisplayName("Villar, El")).toBe("El Villar"); |
| 9 | + }); |
| 10 | + |
| 11 | + it("flips comma-inverted La", () => { |
| 12 | + expect(formatEmbalseDisplayName("Jarosa, La")).toBe("La Jarosa"); |
| 13 | + }); |
| 14 | + |
| 15 | + it("handles compound suffix with hyphen and parens", () => { |
| 16 | + expect(formatEmbalseDisplayName("Vellón,El-(Pedrezuela)")).toBe( |
| 17 | + "El Vellón (Pedrezuela)", |
| 18 | + ); |
| 19 | + }); |
| 20 | + |
| 21 | + it("leaves untouched names without inverted article", () => { |
| 22 | + expect(formatEmbalseDisplayName("Navacerrada")).toBe("Navacerrada"); |
| 23 | + expect(formatEmbalseDisplayName("Entrepeñas")).toBe("Entrepeñas"); |
| 24 | + expect(formatEmbalseDisplayName("Cáceres - Guadiloba")).toBe( |
| 25 | + "Cáceres - Guadiloba", |
| 26 | + ); |
| 27 | + expect(formatEmbalseDisplayName("Gabriel y Galán")).toBe("Gabriel y Galán"); |
| 28 | + }); |
| 29 | + |
| 30 | + it("returns empty string for empty input", () => { |
| 31 | + expect(formatEmbalseDisplayName("")).toBe(""); |
| 32 | + }); |
| 33 | +}); |
0 commit comments