master @ 25 LINES
[ HISTORY ] [ UP ]
┌─ TS ───────────────────────────────────────────────────────────────────────┐
│ import { describe, expect, it } from "vitest"; │
│ import { buildSteps } from "./Steps"; │
│ import { len } from "../../lib/ascii"; │
│ │
│ const STEPS = ["FETCH", "PARSE", "RENDER"]; │
│ │
│ describe("buildSteps", () => { │
│ it("marks done, current, and pending steps", () => { │
│ const out = buildSteps(STEPS, 1, 86); │
│ expect(out).toBe("[x] FETCH ── [>] PARSE ── [ ] RENDER"); │
│ }); │
│ │
│ it("stays horizontal when it fits", () => { │
│ expect(buildSteps(STEPS, 0, 86)).not.toContain("\n"); │
│ }); │
│ │
│ it("stacks on a vertical spine when too wide", () => { │
│ const out = buildSteps(["A LONG STEP NAME", "ANOTHER LONG STEP", "A THIRD STEP │
│ "], 1, 30); │
│ const lines = out.split("\n"); │
│ expect(lines.length).toBe(5); │
│ expect(lines[1]).toBe(" │"); │
│ for (const ln of lines) expect(len(ln)).toBeLessThanOrEqual(30); │
│ }); │
│ }); │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ TS ─────────────────────────────────┐
│ import { describe, expect, it } from "vitest │
│ "; │
│ import { buildSteps } from "./Steps"; │
│ import { len } from "../../lib/ascii"; │
│ │
│ const STEPS = ["FETCH", "PARSE", "RENDER"]; │
│ │
│ describe("buildSteps", () => { │
│ it("marks done, current, and pending steps │
│ ", () => { │
│ const out = buildSteps(STEPS, 1, 86); │
│ expect(out).toBe("[x] FETCH ── [>] PARSE │
│ ── [ ] RENDER"); │
│ }); │
│ │
│ it("stays horizontal when it fits", () => │
│ { │
│ expect(buildSteps(STEPS, 0, 86)).not.toC │
│ ontain("\n"); │
│ }); │
│ │
│ it("stacks on a vertical spine when too wi │
│ de", () => { │
│ const out = buildSteps(["A LONG STEP NAM │
│ E", "ANOTHER LONG STEP", "A THIRD STEP"], 1, │
│ 30); │
│ const lines = out.split("\n"); │
│ expect(lines.length).toBe(5); │
│ expect(lines[1]).toBe(" │"); │
│ for (const ln of lines) expect(len(ln)). │
│ toBeLessThanOrEqual(30); │
│ }); │
│ }); │
└──────────────────────────────────────────────┘
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET