open-swe/ui/src/features/agents/components/chat/ToolExecution.test.ts
Adam Moussa 3b3d45cd94
fix: capitalize dashboard tool labels (#1761)
* fix: capitalize tool labels in dashboard

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>

* fix: sentence-case dashboard tool labels

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>

---------

Co-authored-by: Ramon Nogueira <270434257+ramon-langchain@users.noreply.github.com>
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
(cherry picked from commit dd5b7becb4dc9c633730fb4092a3cbd0c50dae9d)

Co-authored-by: Ramon Nogueira <ramon.nogueira@langchain.dev>
2026-07-17 16:22:38 -04:00

49 lines
1.4 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { formatToolDisplay } from "./toolExecutionDisplay";
describe("formatToolDisplay", () => {
const projectPath = "/workspace/open-swe";
it("renders read_file with the file_path alias consistently", () => {
expect(
formatToolDisplay(
"read_file /workspace/open-swe/AGENTS.md",
"read",
{ file_path: "/workspace/open-swe/AGENTS.md" },
projectPath,
),
).toBe("Read AGENTS.md");
});
it("renders ls as a list operation with a relative path", () => {
expect(
formatToolDisplay(
"ls /workspace/open-swe/ui",
"read",
{ path: "/workspace/open-swe/ui" },
projectPath,
),
).toBe("List ui");
});
it("renders search tools with their pattern", () => {
expect(
formatToolDisplay("grep", "search", { pattern: "tool_calls" }, projectPath),
).toBe('Search "tool_calls"');
});
it("normalizes write_todos", () => {
expect(formatToolDisplay("write todos", "other", {}, projectPath)).toBe("Update todos");
});
it("sentence-cases raw tool names", () => {
expect(formatToolDisplay("enter_plan_mode", "other", {}, projectPath)).toBe(
"Enter plan mode",
);
expect(formatToolDisplay("save_plan", "other", {}, projectPath)).toBe("Save plan");
expect(formatToolDisplay("slack_thread_reply", "other", {}, projectPath)).toBe(
"Slack thread reply",
);
});
});