┌─ TS ───────────────────────────────────────────────────────────────────────┐│ import { describe, expect, it } from "vitest"; ││ import { buildPanelTop, buildPanelBottom } from "./Panel"; ││ import { len } from "../../lib/ascii"; ││ ││ describe("panel borders", () => { ││ it("spans the exact width with and without a title", () => { ││ for (const w of [86, 48]) { ││ expect(len(buildPanelTop(w))).toBe(w); ││ expect(len(buildPanelTop(w, "TELEMETRY"))).toBe(w); ││ expect(len(buildPanelBottom(w))).toBe(w); ││ } ││ }); ││ ││ it("seats the title after the corner", () => { ││ expect(buildPanelTop(20, "LOG")).toBe("┌─ LOG ────────────┐"); ││ }); ││ ││ it("throws when the title cannot fit", () => { ││ expect(() => buildPanelTop(10, "A VERY LONG TITLE")).toThrow(/too long/); ││ }); ││ }); │└────────────────────────────────────────────────────────────────────────────────────┘
┌─ TS ─────────────────────────────────┐│ import { describe, expect, it } from "vitest ││ "; ││ import { buildPanelTop, buildPanelBottom } f ││ rom "./Panel"; ││ import { len } from "../../lib/ascii"; ││ ││ describe("panel borders", () => { ││ it("spans the exact width with and without ││ a title", () => { ││ for (const w of [86, 48]) { ││ expect(len(buildPanelTop(w))).toBe(w); ││ expect(len(buildPanelTop(w, "TELEMETRY ││ "))).toBe(w); ││ expect(len(buildPanelBottom(w))).toBe( ││ w); ││ } ││ }); ││ ││ it("seats the title after the corner", () ││ => { ││ expect(buildPanelTop(20, "LOG")).toBe("┌ ││ ─ LOG ────────────┐"); ││ }); ││ ││ it("throws when the title cannot fit", () ││ => { ││ expect(() => buildPanelTop(10, "A VERY L ││ ONG TITLE")).toThrow(/too long/); ││ }); ││ }); │└──────────────────────────────────────────────┘