Fetch command output the server left out, for the open row and Copy output

This commit is contained in:
Callum Alpass committed 2026-11-02 23:19:54 +11:00
1 parent 81a1ee942c
commit 3ef67c5b50
5 files changed
+103 -8

No files matched your search

+25 -1
View File
@@ -1,6 +1,6 @@
import { afterEach, describe, expect, test } from "bun:test";
import { withApproval, withQuestion } from "./fixtures.ts";
import { omittedCommand, withApproval, withOmittedOutput, withQuestion } from "./fixtures.ts";
import { loadLayout } from "../../src/layout.ts";
import { fakeSession, renderApp, v2ThreadId } from "./harness.tsx";
@@ -243,6 +243,30 @@ describe("connection", () => {
});
});
describe("command output", () => {
const session = () => fakeSession({ projection: withOmittedOutput(), results: { turnItem: { ...omittedCommand, outputOmitted: false, output: "12 pass\n0 fail" } } });
test("output the server left out loads when the command opens", async () => {
const app = await open({ session: session() });
const row = app.find("bun test");
await app.click(row.x, row.y);
await app.settle(50);
expect(app.calls("turnItem").map((call) => call.args)).toEqual([[omittedCommand.threadId, omittedCommand.id]]);
expect(app.frame()).toContain("12 pass");
});
test("Copy output fetches it first", async () => {
const app = await open({ session: session() });
const row = app.find("bun test");
await app.click(row.x, row.y, 2);
await app.type("copy output");
await app.press("return");
await app.settle(50);
expect(app.calls("turnItem")).toHaveLength(1);
expect(app.hints()).toBe("Copied the output");
});
});
describe("mouse", () => {
test("the header button opens the palette", async () => {
const app = await open();