From e01afb407c4b3eb50e85e7356b0be9489fb26eba Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Wed, 21 May 2025 10:30:39 -0400 Subject: add tool tests --- js/test/tool/tool.test.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 js/test/tool/tool.test.ts (limited to 'js/test') diff --git a/js/test/tool/tool.test.ts b/js/test/tool/tool.test.ts new file mode 100644 index 000000000..4e9daf152 --- /dev/null +++ b/js/test/tool/tool.test.ts @@ -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, + }); + }); + }); +}); -- cgit v1.2.3