Files
oh-my-pi/packages/coding-agent/test/session-color.test.ts
T
can1357 11b7ba7846 fix(coding-agent): respected session title source when formatting terminal titles
- Propagated session title source through terminal-title update calls so auto and user names are handled consistently across controllers.
- Suppressed auto-generated names in status-line segments and completion messages by falling back to cwd-based titles.
- Updated title formatter tests to verify auto-generated and user-specified session titles produce different terminal labels.
2026-04-13 06:22:37 +02:00

27 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "bun:test";
import { getSessionAccentHex, getSessionAccentHexForTitle } from "../src/utils/session-color";
import { formatSessionTerminalTitle } from "../src/utils/title-generator";
describe("getSessionAccentHexForTitle", () => {
it("ignores auto-generated titles", () => {
expect(getSessionAccentHexForTitle("Auto title", "auto")).toBeUndefined();
});
it("keeps explicit and legacy titles color-stable", () => {
const expected = getSessionAccentHex("Named session");
expect(getSessionAccentHexForTitle("Named session", "user")).toBe(expected);
expect(getSessionAccentHexForTitle("Named session", undefined)).toBe(expected);
});
});
describe("formatSessionTerminalTitle", () => {
it("falls back to cwd when the session title was auto-generated", () => {
expect(formatSessionTerminalTitle("Auto title", "/work/pi", "auto")).toBe("π: pi");
});
it("shows explicit session renames in the terminal title", () => {
expect(formatSessionTerminalTitle("Manual title", "/work/pi", "user")).toBe("π: Manual title");
});
});