49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
/** @jsxImportSource @opentui/solid */
|
|
import { expect, test } from "bun:test"
|
|
import { testRender } from "@opentui/solid"
|
|
import { createSignal } from "solid-js"
|
|
import { RunEntryContent } from "@/cli/cmd/run/scrollback.writer"
|
|
import { RUN_THEME_FALLBACK } from "@/cli/cmd/run/theme"
|
|
import type { StreamCommit } from "@/cli/cmd/run/types"
|
|
|
|
test("run entry content updates when live commit text changes", async () => {
|
|
const [commit, setCommit] = createSignal<StreamCommit>({
|
|
kind: "tool",
|
|
text: "I",
|
|
phase: "progress",
|
|
source: "tool",
|
|
messageID: "msg-1",
|
|
partID: "part-1",
|
|
tool: "bash",
|
|
})
|
|
|
|
const app = await testRender(() => (
|
|
<box width={80} height={4}>
|
|
<RunEntryContent commit={commit()} theme={RUN_THEME_FALLBACK} width={80} />
|
|
</box>
|
|
), {
|
|
width: 80,
|
|
height: 4,
|
|
})
|
|
|
|
try {
|
|
await app.renderOnce()
|
|
expect(app.captureCharFrame()).toContain("I")
|
|
|
|
setCommit({
|
|
kind: "tool",
|
|
text: "I need to inspect the codebase",
|
|
phase: "progress",
|
|
source: "tool",
|
|
messageID: "msg-1",
|
|
partID: "part-1",
|
|
tool: "bash",
|
|
})
|
|
await app.renderOnce()
|
|
|
|
expect(app.captureCharFrame()).toContain("I need to inspect the codebase")
|
|
} finally {
|
|
app.renderer.destroy()
|
|
}
|
|
})
|