OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
 
master @ 25 LINES
 
[ HISTORY ]  [ UP ]
 

import { describe, expect, it } from "vitest";
import { layoutDiff } from "./Diff";
import { len } from "../../lib/ascii";

const DIFF = "@@ -1,2 +1,2 @@\n-old line\n+new line\n context";

describe("layoutDiff", () => {
  it("classifies rows through the shared pipeline classifier", () => {
    const rows = layoutDiff(DIFF, 48);
    expect(rows.map((r) => r.cls)).toEqual(["diff-hunk", "diff-del", "diff-add", n
ull]);
  });

  it("pads every row to the inner width", () => {
    for (const r of layoutDiff(DIFF, 48)) {
      expect(len(r.text) + r.pad).toBe(44);
    }
  });

  it("keeps the class on wrapped continuation chunks", () => {
    const rows = layoutDiff(`+${"x".repeat(100)}`, 48);
    expect(rows.length).toBeGreaterThan(1);
    expect(rows.every((r) => r.cls === "diff-add")).toBe(true);
  });
});

import { describe, expect, it } from "vitest
";
import { layoutDiff } from "./Diff";
import { len } from "../../lib/ascii";

const DIFF = "@@ -1,2 +1,2 @@\n-old line\n+n
ew line\n context";

describe("layoutDiff", () => {
  it("classifies rows through the shared pip
eline classifier", () => {
    const rows = layoutDiff(DIFF, 48);
    expect(rows.map((r) => r.cls)).toEqual([
"diff-hunk", "diff-del", "diff-add", null]);
  });

  it("pads every row to the inner width", ()
 => {
    for (const r of layoutDiff(DIFF, 48)) {
      expect(len(r.text) + r.pad).toBe(44);
    }
  });

  it("keeps the class on wrapped continuatio
n chunks", () => {
    const rows = layoutDiff(`+${"x".repeat(1
00)}`, 48);
    expect(rows.length).toBeGreaterThan(1);
    expect(rows.every((r) => r.cls === "diff
-add")).toBe(true);
  });
});
 
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET