fix(tui): separate thinking header from markdown body (#29028)
This commit is contained in:
36
packages/opencode/test/cli/tui/thinking.test.ts
Normal file
36
packages/opencode/test/cli/tui/thinking.test.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import { reasoningSummary } from "../../../src/cli/cmd/tui/context/thinking"
|
||||
|
||||
describe("reasoningSummary", () => {
|
||||
test("extracts a leading summary title and leaves markdown body", () => {
|
||||
expect(reasoningSummary("**Continuing Quality Review**\n\nDetails.\n\n**Next section**\n\nMore.")).toEqual({
|
||||
title: "Continuing Quality Review",
|
||||
body: "Details.\n\n**Next section**\n\nMore.",
|
||||
})
|
||||
})
|
||||
|
||||
test("extracts a completed title before its streamed body arrives", () => {
|
||||
expect(reasoningSummary("**Continuing Quality Review**")).toEqual({
|
||||
title: "Continuing Quality Review",
|
||||
body: "",
|
||||
})
|
||||
})
|
||||
|
||||
test("preserves markdown-significant indentation in the extracted body", () => {
|
||||
expect(reasoningSummary("**Continuing Quality Review**\n\n const value = true\n")).toEqual({
|
||||
title: "Continuing Quality Review",
|
||||
body: " const value = true",
|
||||
})
|
||||
})
|
||||
|
||||
test("does not consume ordinary leading bold content", () => {
|
||||
expect(reasoningSummary("**Important:** keep this in the body.")).toEqual({
|
||||
title: null,
|
||||
body: "**Important:** keep this in the body.",
|
||||
})
|
||||
})
|
||||
|
||||
test("leaves content without a leading title in its body", () => {
|
||||
expect(reasoningSummary("Details only.")).toEqual({ title: null, body: "Details only." })
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user