master @ 27 LINES
[ HISTORY ] [ UP ]
┌─ TS ───────────────────────────────────────────────────────────────────────┐
│ import { describe, expect, it } from "vitest"; │
│ import { frameLabel } from "./CodeFrame"; │
│ import { layoutDiff } from "../Diff/Diff"; │
│ │
│ describe("frameLabel", () => { │
│ it("passes short labels through", () => { │
│ expect(frameLabel("TS", 48)).toBe("TS"); │
│ }); │
│ it("keeps the tail of long paths", () => { │
│ const long = "ooknet-design/src/components/ArticleBacklinks/ArticleBacklinks.a │
│ stro"; │
│ const label = frameLabel(long, 48); │
│ expect(label.startsWith("...")).toBe(true); │
│ expect(label.endsWith("ArticleBacklinks.astro")).toBe(true); │
│ }); │
│ }); │
│ │
│ describe("layoutDiff classify flag", () => { │
│ it("skips diff classes when off", () => { │
│ const rows = layoutDiff("+added\n-removed", 48, false); │
│ expect(rows.every((r) => r.cls === null)).toBe(true); │
│ }); │
│ it("keeps them when on", () => { │
│ const rows = layoutDiff("+added\n-removed", 48, true); │
│ expect(rows.map((r) => r.cls)).toEqual(["diff-add", "diff-del"]); │
│ }); │
│ }); │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ TS ─────────────────────────────────┐
│ import { describe, expect, it } from "vitest │
│ "; │
│ import { frameLabel } from "./CodeFrame"; │
│ import { layoutDiff } from "../Diff/Diff"; │
│ │
│ describe("frameLabel", () => { │
│ it("passes short labels through", () => { │
│ expect(frameLabel("TS", 48)).toBe("TS"); │
│ }); │
│ it("keeps the tail of long paths", () => { │
│ const long = "ooknet-design/src/componen │
│ ts/ArticleBacklinks/ArticleBacklinks.astro"; │
│ const label = frameLabel(long, 48); │
│ expect(label.startsWith("...")).toBe(tru │
│ e); │
│ expect(label.endsWith("ArticleBacklinks. │
│ astro")).toBe(true); │
│ }); │
│ }); │
│ │
│ describe("layoutDiff classify flag", () => { │
│ it("skips diff classes when off", () => { │
│ const rows = layoutDiff("+added\n-remove │
│ d", 48, false); │
│ expect(rows.every((r) => r.cls === null) │
│ ).toBe(true); │
│ }); │
│ it("keeps them when on", () => { │
│ const rows = layoutDiff("+added\n-remove │
│ d", 48, true); │
│ expect(rows.map((r) => r.cls)).toEqual([ │
│ "diff-add", "diff-del"]); │
│ }); │
│ }); │
└──────────────────────────────────────────────┘
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET