import { describe, expect, it } from "vitest"; import { findViolations } from "./check-rtl-classes.mjs"; const hits = (src: string) => findViolations(src, "x.tsx").map((v) => v.match); describe("check-rtl-classes", () => { it("flags physical directional utilities", () => { expect(hits(`
`)).toHaveLength(7); expect(hits(``)).toHaveLength(1); }); it("ignores logical, symmetric, compound and rtl-variant classes", () => { expect( hits( ``, ), ).toHaveLength(0); }); it("honours rtl-ok escapes on the same or previous line", () => { expect(hits(`{/* rtl-ok */}\n`)).toHaveLength(0); expect(hits(` {/* rtl-ok */}`)).toHaveLength(0); }); it("skips test files", () => { expect(findViolations(`"ml-2"`, "src/x/__tests__/y.test.tsx")).toHaveLength(0); }); });