tool.test.ts 901 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { describe, expect, test } from "bun:test";
  2. import { App } from "../../src/app";
  3. import { glob } from "../../src/tool/glob";
  4. describe("tool.glob", () => {
  5. test("truncate", async () => {
  6. await App.provide({ directory: process.cwd() }, async () => {
  7. let result = await glob.execute(
  8. {
  9. pattern: "./node_modules/**/*",
  10. },
  11. {
  12. toolCallId: "test",
  13. messages: [],
  14. },
  15. );
  16. expect(result.metadata.truncated).toBe(true);
  17. });
  18. });
  19. test("basic", async () => {
  20. await App.provide({ directory: process.cwd() }, async () => {
  21. let result = await glob.execute(
  22. {
  23. pattern: "*.json",
  24. },
  25. {
  26. toolCallId: "test",
  27. messages: [],
  28. },
  29. );
  30. expect(result.metadata).toMatchObject({
  31. truncated: false,
  32. count: 3,
  33. });
  34. });
  35. });
  36. });