import { describe, expect, it } from "vitest" import { equalsIgnoreCase, equalsIgnoreCaseAndAccents } from "./stringEquals" describe("equalsIgnoreCase", () => { it("returns true for identical strings", () => { expect(equalsIgnoreCase("Hello", "Hello")).toBe(true) }) it("is case-insensitive for ASCII letters", () => { expect(equalsIgnoreCase("Hello", "hello")).toBe(true) expect(equalsIgnoreCase("TEST", "test")).toBe(true) }) it("returns false for different strings", () => { expect(equalsIgnoreCase("apple", "apricot")).toBe(false) }) it("handles empty strings", () => { expect(equalsIgnoreCase("", "")).toBe(true) expect(equalsIgnoreCase("", " ")).toBe(false) }) it("takes diacritics into account", () => { expect(equalsIgnoreCase("resume", "résumé")).toBe(false) }) it("treats composed and decomposed forms as equal", () => { // composed vs decomposed (e + combining acute) expect(equalsIgnoreCase("é", "e\u0301")).toBe(true) }) it("considers whitespace and length differences significant", () => { expect(equalsIgnoreCase(" hello", "hello")).toBe(false) expect(equalsIgnoreCase("hello", "hello ")).toBe(false) }) }) describe("equalsIgnoreCaseAndAccents", () => { it("returns true for identical strings", () => { expect(equalsIgnoreCaseAndAccents("Hello", "Hello")).toBe(true) }) it("is case-insensitive for ASCII letters", () => { expect(equalsIgnoreCaseAndAccents("Hello", "hello")).toBe(true) expect(equalsIgnoreCaseAndAccents("TEST", "test")).toBe(true) }) it("returns false for different strings", () => { expect(equalsIgnoreCaseAndAccents("apple", "apricot")).toBe(false) }) it("handles empty strings", () => { expect(equalsIgnoreCaseAndAccents("", "")).toBe(true) expect(equalsIgnoreCaseAndAccents("", " ")).toBe(false) }) it("ignores diacritics / treats composed and decomposed forms as equal (sensitivity: base)", () => { expect(equalsIgnoreCaseAndAccents("resume", "résumé")).toBe(true) // composed vs decomposed (e + combining acute) expect(equalsIgnoreCaseAndAccents("é", "e\u0301")).toBe(true) }) it("considers whitespace and length differences significant", () => { expect(equalsIgnoreCaseAndAccents(" hello", "hello")).toBe(false) expect(equalsIgnoreCaseAndAccents("hello", "hello ")).toBe(false) }) })