57 lines · 1.4 KB · TypeScript
RawDownload
import { describe, expect, it } from "vitest"; import { deriveToolActivityPresentation } from "./toolActivity.ts"; describe("toolActivity", () => {  it("normalizes command tools to a stable ran-command label", () => {    expect(      deriveToolActivityPresentation({        itemType: "command_execution",        title: "Terminal",        detail: "Terminal",        data: {          command: "bun run lint",        },        fallbackSummary: "Terminal",      }),    ).toEqual({      summary: "Ran command",      detail: "bun run lint",    });  });   it("uses structured file paths for read-file tools when available", () => {    expect(      deriveToolActivityPresentation({        itemType: "dynamic_tool_call",        title: "Read File",        detail: "Read File",        data: {          kind: "read",          locations: [{ path: "/tmp/app.ts" }],        },        fallbackSummary: "Read File",      }),    ).toEqual({      summary: "Read file",      detail: "/tmp/app.ts",    });  });   it("drops duplicated generic read-file detail when no path is available", () => {    expect(      deriveToolActivityPresentation({        itemType: "dynamic_tool_call",        title: "Read File",        detail: "Read File",        data: {          kind: "read",          rawInput: {},        },        fallbackSummary: "Read File",      }),    ).toEqual({      summary: "Read file",    });  });});

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t