// LV-2: homograph detector tests. import { describe, expect, it } from "vitest"; import { detectHomograph } from "./domain"; describe("detectHomograph", () => { it("flags a hostname with non-ASCII (Cyrillic homograph) characters", () => { // "аpple.com" — leading а is Cyrillic U+0430, not Latin a. expect(detectHomograph("https://аpple.com")).toBe(true); }); it("flags a punycode (xn--) label", () => { expect(detectHomograph("https://xn--pple-43d.com")).toBe(true); }); it("accepts a bare hostname without a scheme", () => { expect(detectHomograph("xn--pple-43d.com")).toBe(true); }); it("returns false for a plain ASCII domain", () => { expect(detectHomograph("https://apple.com")).toBe(false); }); it("returns false for malformed input", () => { expect(detectHomograph("")).toBe(false); expect(detectHomograph("http://")).toBe(false); }); });