| 123456789101112131415161718192021222324252627282930313233343536 |
- import { describe, expect, test } from "bun:test"
- import { reasoningSummary } from "../../../src/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." })
- })
- })
|