summaryrefslogtreecommitdiffhomepage
path: root/js/test/tool/tool.test.ts
blob: 4e9daf152b0d58c4326024415fe82cd3f5684b86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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,
      });
    });
  });
});