opencode/packages/tui/test/mini/footer.test.ts
Simon Klee 925c2423de
mini: add reconnect, forms, and shared targets (#37811)
Centralize session target resolution for mini and noninteractive
run paths. Recover from transport drops, replace questions with
forms, and keep tool/catalog state location-scoped with live
progress and theme discovery.
2026-07-19 22:45:10 +02:00

25 lines
870 B
TypeScript

import { expect, test } from "bun:test"
import { coalesceProgressCommit } from "../../src/mini/footer"
import type { StreamCommit } from "../../src/mini/types"
function progress(input: Partial<StreamCommit> = {}): StreamCommit {
return {
kind: "tool",
source: "tool",
phase: "progress",
text: "one",
messageID: "msg_1",
partID: "part_1",
tool: "shell",
toolState: "running",
...input,
}
}
test("coalesces progress only within the same message and tool state", () => {
expect(coalesceProgressCommit(progress(), progress({ messageID: "msg_2" }))).toBeUndefined()
expect(coalesceProgressCommit(progress(), progress({ toolState: "completed" }))).toBeUndefined()
expect(coalesceProgressCommit(progress(), progress({ text: "two", directory: "/latest" }))).toEqual(
progress({ text: "onetwo", directory: "/latest" }),
)
})