// RootFilesWarning (#427) through the REAL locales: the plural forms // (`message_one`/`message_other`, `more_one`/`more_other`) and the quotes // around the folder name only exist in fr.json and en.json, which the marked // `t` of RootFilesWarning.test.tsx never reads. import { describe, it, expect, afterAll } from "vitest"; import { renderToStaticMarkup } from "react-dom/server"; import i18n from "../../i18n/config"; import RootFilesWarning from "./RootFilesWarning"; const text = (names: string[]) => renderToStaticMarkup() .replace(/<[^>]+>/g, ""); const SEVEN = ["1.csv", "2.csv", "3.csv", "4.csv", "5.csv", "6.csv", "7.csv"]; afterAll(async () => { await i18n.changeLanguage("fr"); }); describe("RootFilesWarning — French (#427)", () => { it("singular", async () => { await i18n.changeLanguage("fr"); expect(text(["a.csv"])).toBe( "1 fichier est posé directement dans « Relevés » et est ignoré : a.csv. Déplacez-le dans un sous-dossier par compte.", ); }); it("plural, five names then « et 2 autres »", async () => { await i18n.changeLanguage("fr"); expect(text(SEVEN)).toBe( "7 fichiers sont posés directement dans « Relevés » et sont ignorés : 1.csv, 2.csv, 3.csv, 4.csv, 5.csv et 2 autres. Déplacez-les dans un sous-dossier par compte.", ); }); it("one more: « et 1 autre »", async () => { await i18n.changeLanguage("fr"); expect(text(SEVEN.slice(0, 6))).toContain("5.csv et 1 autre."); }); }); describe("RootFilesWarning — English (#427)", () => { it("singular", async () => { await i18n.changeLanguage("en"); expect(text(["a.csv"])).toBe( "1 file sits directly in “Relevés” and is ignored: a.csv. Move it into a subfolder per account.", ); }); it("plural, five names then “and 2 more”", async () => { await i18n.changeLanguage("en"); expect(text(SEVEN)).toBe( "7 files sit directly in “Relevés” and are ignored: 1.csv, 2.csv, 3.csv, 4.csv, 5.csv and 2 more. Move them into a subfolder per account.", ); }); });