mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-04 08:24:59 +01:00
add tool tests
This commit is contained in:
37
js/test/tool/tool.test.ts
Normal file
37
js/test/tool/tool.test.ts
Normal 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,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user