/** @jsxImportSource @opentui/solid */
import { expect, test } from "bun:test"
import { testRender } from "@opentui/solid"
import { PromptInterruptHint, PromptRetryStatus } from "../../src/component/prompt/retry-status"
import { RGBA } from "@opentui/core"
import type { Theme } from "../../src/theme"
function RetryRow() {
const theme = {
error: RGBA.fromInts(255, 0, 0, 255),
primary: RGBA.fromInts(255, 255, 255, 255),
text: RGBA.fromInts(255, 255, 255, 255),
textMuted: RGBA.fromInts(128, 128, 128, 255),
} as Theme
return (
[⋯]
)
}
test("retry status keeps the interrupt hint on one line", async () => {
const app = await testRender(() => , { width: 50, height: 4 })
try {
await app.renderOnce()
const frame = app.captureCharFrame()
expect(frame).toContain("Too Many Reque")
expect(frame).toContain("esc interrupt")
expect(frame.split("\n").filter((line) => line.trim()).length).toBe(1)
} finally {
app.renderer.destroy()
}
})