chore(test): synchronized test expectations with output and cleanup formatting

- Updated `hashline` test expectations to match new recovery message strings.
- Initialized settings in `interactive-mode-status` tests to prevent state leakage.
- Added ANSI color code verification to `launch` tool tests to align with updated output.
- Cleaned up whitespace in `tan-context-switch.md` system prompt.
This commit is contained in:
can1357
2026-07-13 18:27:25 +02:00
parent 0f9a301536
commit 6fcb1b3008
4 changed files with 10 additions and 5 deletions
@@ -1,5 +1,5 @@
<system-notice cause="fork">
The conversation above belongs to your parent session.
The conversation above belongs to your parent session.
You are a fork created solely to handle the user's request below.
Your parent agent is still working on the original task — that responsibility is
@@ -369,7 +369,7 @@ describe("hashline — anchor-stale recovery via read snapshot cache", () => {
expect(finalLines).toContain("L8");
const text = result.content[0]?.type === "text" ? result.content[0].text : "";
expect(text).toMatch(/Recovered from a stale file hash using a previous read snapshot/);
expect(text).toMatch(/Recovered by remapping stale line anchors to unchanged current lines/);
});
});
@@ -437,7 +437,7 @@ describe("hashline — anchor-stale recovery via read snapshot cache", () => {
expect(finalLines).toContain("GAMMA");
expect(finalLines).not.toContain("gamma");
const text = result.content[0]?.type === "text" ? result.content[0].text : "";
expect(text).toMatch(/Recovered from a stale file hash using a previous read snapshot/);
expect(text).toMatch(/Recovered by remapping stale line anchors to unchanged current lines/);
});
});
@@ -1,5 +1,6 @@
import { beforeAll, describe, expect, test, vi } from "bun:test";
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
import { resetSettingsForTest, Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
import { initTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
import type { InteractiveModeContext } from "@oh-my-pi/pi-coding-agent/modes/types";
import { UiHelpers } from "@oh-my-pi/pi-coding-agent/modes/utils/ui-helpers";
@@ -64,7 +65,10 @@ function createInitialRenderHarness(): { ctx: InteractiveModeContext; helpers: U
describe("InteractiveMode.showStatus", () => {
beforeAll(async () => {
// showStatus uses the global theme instance
// showStatus uses the global theme instance; renderInitialMessages reads
// the global Settings (display.collapseCompacted).
resetSettingsForTest();
await Settings.init({ inMemory: true });
await initTheme();
});
@@ -59,7 +59,7 @@ describe("daemon broker", () => {
`process.stdin.setRawMode?.(true);
process.stdin.setEncoding("utf8");
process.stdin.resume();
process.stdout.write("READY\\n");
process.stdout.write("\\x1b[1;32mREADY\\x1b[0m\\n");
process.stdin.on("data", chunk => process.stdout.write("INPUT:" + JSON.stringify(chunk) + "\\n"));
setInterval(() => {}, 1000);
`,
@@ -114,6 +114,7 @@ setInterval(() => {}, 1000);
expect(logs.op).toBe("logs");
if (logs.op !== "logs") throw new Error("unexpected logs result");
expect(logs.text).toContain("READY");
expect(logs.text).toContain("\x1b[1;32mREADY\x1b[0m");
expect(logs.text).toContain('INPUT:"run\\r"');
const stopped = await first.request({ op: "stop", name: "debugger", timeoutMs: 2_000 });