add tool tests

This commit is contained in:
Dax Raad
2025-05-21 10:30:39 -04:00
parent f0f55bc75f
commit e01afb407c
15 changed files with 306 additions and 244 deletions

37
js/test/tool/tool.test.ts Normal file
View File

@@ -0,0 +1,37 @@
import { describe, expect, test } from "bun:test";
import { App } from "../../src/app";
import { glob } from "../../src/tool/glob";
describe("tool.glob", () => {
test("truncate", async () => {
await App.provide({ directory: process.cwd() }, async () => {
let result = await glob.execute(
{
pattern: "./node_modules/**/*",
},
{
toolCallId: "test",
messages: [],
},
);
expect(result.metadata.truncated).toBe(true);
});
});
test("basic", async () => {
await App.provide({ directory: process.cwd() }, async () => {
let result = await glob.execute(
{
pattern: "*.json",
},
{
toolCallId: "test",
messages: [],
},
);
expect(result.metadata).toMatchObject({
truncated: false,
count: 3,
});
});
});
});