master @ 22 LINES
[ HISTORY ] [ UP ]
┌─ TS ───────────────────────────────────────────────────────────────────────┐
│ import { describe, expect, it } from "vitest"; │
│ import { buildBanner } from "./Banner"; │
│ import { len } from "../../lib/ascii"; │
│ │
│ describe("buildBanner", () => { │
│ it("renders every line at the frame width", () => { │
│ for (const w of [48, 86]) { │
│ const out = buildBanner("warning", "frequency drift detected on channel brav │
│ o", w); │
│ for (const ln of out.split("\n")) expect(len(ln)).toBe(w); │
│ } │
│ }); │
│ │
│ it("embeds the variant label in the top rule", () => { │
│ expect(buildBanner("error", "x", 48).split("\n")[0]).toContain("─ ERROR ─"); │
│ }); │
│ │
│ it("wraps long messages", () => { │
│ const out = buildBanner("notice", "word ".repeat(30).trim(), 48); │
│ expect(out.split("\n").length).toBeGreaterThan(4); │
│ }); │
│ }); │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ TS ─────────────────────────────────┐
│ import { describe, expect, it } from "vitest │
│ "; │
│ import { buildBanner } from "./Banner"; │
│ import { len } from "../../lib/ascii"; │
│ │
│ describe("buildBanner", () => { │
│ it("renders every line at the frame width" │
│ , () => { │
│ for (const w of [48, 86]) { │
│ const out = buildBanner("warning", "fr │
│ equency drift detected on channel bravo", w) │
│ ; │
│ for (const ln of out.split("\n")) expe │
│ ct(len(ln)).toBe(w); │
│ } │
│ }); │
│ │
│ it("embeds the variant label in the top ru │
│ le", () => { │
│ expect(buildBanner("error", "x", 48).spl │
│ it("\n")[0]).toContain("─ ERROR ─"); │
│ }); │
│ │
│ it("wraps long messages", () => { │
│ const out = buildBanner("notice", "word │
│ ".repeat(30).trim(), 48); │
│ expect(out.split("\n").length).toBeGreat │
│ erThan(4); │
│ }); │
│ }); │
└──────────────────────────────────────────────┘
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET