import { test } from "node:test"; // The smallest row count that shows a gated decision with a task, per width, for a short and a long // question. Run: CLI=/packages/cli node --test probe-round3.mjs const CLI = process.env.CLI; const { App } = await import(`${CLI}/src/app.mjs`); const { decideShown } = await import(`${CLI}/src/screens.mjs`); const { broker } = await import(`${CLI}/tests/helpers.mjs`); test("probe", async (t) => { for (const long of [false, true]) { const bus = broker(t); const question = long ? Array.from({ length: 90 }, (_, i) => `word${i}`).join(" ") : "Push the release?"; bus.raise("git.push.protected", { target: "refactor", blocking: true, task_ref: "vikunja:1/7", question }); const a = new App({ business: "demo", transport: (b) => bus.transport(b), cols: 120, rows: 40, refreshMs: 0, askMs: 0 }); await a.start(); await a.input("1"); const o = a.state.overlay; const out = []; for (const cols of [40, 50, 60, 80, 120]) { let min = null; for (let rows = 10; rows <= 40; rows++) if (decideShown(o, cols, rows)) { min = rows; break; } out.push(`${cols}:${min}`); } console.log(long ? "long" : "short", out.join(" ")); a.quit("q"); } });