test: remove unreachable cases and strengthen weak assertions

This commit is contained in:
chengyongru authored and chengyongru committed 2026-10-22 17:19:20 +08:00
1 parent 169062be11
commit abfe510ce1
25 files changed
+64 -302

No files matched your search

+1 -1
View File
@@ -528,7 +528,7 @@ describe("NanobotTui composer", () => {
ui.composer.setText("ask @github next")
ui.composer.submit()
await waitUntil(() => sent.length === 2)
expect(ui.status.plainText).not.toContain("Steering")
expect(ui.status.plainText).toMatch(/^Thinking\s+\d+s/u)
expect(ui.composer.placeholder).toBe("Enter send now Tab send next")
expect(sentOptions[1]).toEqual({
cliApps: [{ name: "github" }],
-2
View File
@@ -188,8 +188,6 @@ describe("NanobotTui layout and themes", () => {
expect(setup.renderer.width).toBe(width)
expect(setup.renderer.height).toBe(height)
expect(frame).not.toContain("undefined")
expect(frame).not.toContain("Steer this turn…")
expect(frame).not.toContain("Ask a follow-up…")
if (width >= 40 && height >= 9) {
expect(occurrences(frame, "Enter send now Tab send next")).toBe(1)
} else if (width >= 28 && height >= 9) {
+2 -8
View File
@@ -553,14 +553,11 @@ describe("NanobotTui session navigation", () => {
const ui = app as unknown as {
composer: TextareaRenderable
sessionMenu: { visible: boolean; root: { getChildren(): unknown[] } }
title: { getChildren(): unknown[] }
}
try {
await waitUntil(() => (app as unknown as { ready: boolean }).ready)
await setup.renderOnce()
const titleItems = ui.title.getChildren() as TextRenderable[]
expect(titleItems.some((item) => item.id === "nanobot-tui-title-text")).toBe(false)
expect(ui.sessionMenu.visible).toBe(false)
ui.composer.setText("/sessions")
@@ -849,7 +846,7 @@ describe("NanobotTui session navigation", () => {
}
})
test("shows compact session context without exposing private reasoning", async () => {
test("shows compact session context and preserves the composer on resize", async () => {
setup = await createRenderer({ width: 96, height: 26, screenMode: "alternate-screen" })
const original = globalThis.fetch
globalThis.fetch = ((input: string | URL | Request) => {
@@ -888,14 +885,11 @@ describe("NanobotTui session navigation", () => {
expect(frame).toContain("~2.2k tokens 10 replay 16 archived")
expect(frame).toContain("The earlier turns agreed on a release plan.")
expect(frame).not.toContain("Agent context")
expect(frame).not.toContain("summary active")
expect(frame).not.toContain("memory, instructions, and skills are added separately")
setup.resize(40, 10)
await setup.renderOnce()
const compact = setup.captureCharFrame()
expect(occurrences(compact, "Agent context")).toBe(0)
expect(compact).not.toContain("The earlier turns agreed")
expect(occurrences(compact, "Ask nanobot anything")).toBe(1)
setup.mockInput.pressEscape()
+1 -2
View File
@@ -292,7 +292,7 @@ describe("NanobotTui transcript", () => {
max_attempts: 4,
error_kind: "connection",
})
expect(ui.status.plainText).not.toContain("retrying")
expect(ui.status.plainText).toMatch(/^Working\s+\d+s/u)
app.accept({
event: "turn_end",
@@ -312,7 +312,6 @@ describe("NanobotTui transcript", () => {
expect(frame).toContain("Could not connect to the model provider.")
expect(frame.replace(/\s+/gu, " ")).toContain(terminalFailure)
expect(frame).not.toContain("Unlocalized server failure")
expect(frame).not.toContain("Last turn failed")
expect(ui.status.plainText).toBe("Ready")
})
-3
View File
@@ -84,8 +84,5 @@ describe("TUI host integration", () => {
"--source", "nanobot:tui:metadata", "--seq", "3", "--clear-title",
],
])
expect(commands.flat()).not.toContain("report-agent")
expect(commands.flat()).not.toContain("report-agent-session")
expect(commands.flat()).not.toContain("--token")
})
})
+1 -3
View File
@@ -24,7 +24,7 @@ describe("ContextPanel", () => {
setup = undefined
})
test("omits explanatory copy when no compacted summary exists", async () => {
test("renders replay statistics when no compacted summary exists", async () => {
setup = await createTestRenderer({ width: 80, height: 18, screenMode: "alternate-screen" })
const panel = new ContextPanel(setup.renderer, {
text: "#FFFFFF",
@@ -37,7 +37,5 @@ describe("ContextPanel", () => {
const frame = setup.captureCharFrame()
expect(frame).toContain("~950 tokens 8 replay 0 archived")
expect(frame).not.toContain("Agent context")
expect(frame).not.toContain("no compacted summary")
})
})