Files
oh-my-pi/packages/coding-agent/test/tools/glob-renderer.test.ts
T
can1357 ae1650d689 refactor: renamed search and find tools to grep and glob
- Renamed the `find` and `search` tools to `glob` and `grep` respectively across the codebase to improve command clarity.
- Implemented full-stack support for the renamed tools, including CLI arguments, system prompts, SDK exports, and tool registration.
- Added automated migration logic in `settings` to transform legacy `find` and `search` configuration keys to their new equivalents.
- Updated the `collab-web` renderer registry to ensure backwards compatibility with legacy tool outputs.
2026-06-27 00:57:55 +02:00

29 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "bun:test";
import { getThemeByName } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
import { sanitizeText } from "@oh-my-pi/pi-utils";
import { globToolRenderer } from "../../src/tools/glob";
describe("globToolRenderer", () => {
it("indents inline glob output and avoids accent-colored success headers", async () => {
const theme = await getThemeByName("dark");
expect(theme).toBeDefined();
const uiTheme = theme!;
const result = {
content: [{ type: "text", text: "" }],
details: {
fileCount: 2,
files: ["src/a.ts", "src/b.ts"],
},
};
const renderedLines = globToolRenderer
.renderResult(result as never, { expanded: true, isPartial: false }, uiTheme, { paths: "src/**/*.ts" })
.render(240);
const plainLines = sanitizeText(renderedLines.join("\n")).split("\n");
expect(plainLines.every(line => line.startsWith(" "))).toBe(true);
expect(renderedLines[0]).not.toContain(uiTheme.fg("accent", uiTheme.symbol("icon.search")));
expect(renderedLines[0]).not.toContain(uiTheme.fg("accent", "Find"));
});
});