diff --git a/tests/parse_csv.test.ts b/tests/parse_csv.test.ts index 0c166c2..63360ec 100644 --- a/tests/parse_csv.test.ts +++ b/tests/parse_csv.test.ts @@ -117,3 +117,29 @@ describe("markdown table", () => { ).toThrow("Invalid header length: 3"); }); }); +describe("With accents", () => { + it("passing markdown table", () => { + const csvContent = + "| Term | Synonyms |\n" + + "| ----- | -------- |\n" + + "| café | café |\n" + + "| rôle | rôle |\n"; + const expected = { + café: new Set(["cafe"]), + rôle: new Set(["role"]), + } + const separator: Separator = "md"; + const thesaurus = getThesaurus(csvContent, separator, mockTranslation, columnNames, true); + expect(thesaurus).toEqual(expected); + }) + it("passing csv", () =>{ + const csvContent = "Term,Synonyms\ncafé,café\nrôle,rôle"; + const expected = { + café: new Set(["cafe"]), + rôle: new Set(["role"]), + } + const separator: Separator = ","; + const thesaurus = getThesaurus(csvContent, separator, mockTranslation, columnNames, true); + expect(thesaurus).toEqual(expected); + }) +}) \ No newline at end of file diff --git a/tests/parse_file.test.ts b/tests/parse_file.test.ts index f1d8522..d7fc62f 100644 --- a/tests/parse_file.test.ts +++ b/tests/parse_file.test.ts @@ -77,3 +77,20 @@ describe("should not return tags", () => { expect(result).toEqual([]); }); }); + +describe("Find without accents", () => { + const thesaurus: Thesaurus = { + cafe: new Set(["cafe", "chocolate"]), + role: new Set(["role", "roliste"]), + }; + it("should find tag with accents", () => { + const content = "This content contains café."; + const result = getTags(content, thesaurus, true); + expect(result).toEqual(["cafe"]); + }); + it("should find tag without accents", () => { + const content = "This content contains cafe."; + const result = getTags(content, thesaurus, true); + expect(result).toEqual(["cafe"]); + }); +}); \ No newline at end of file