|
@@ -3,6 +3,12 @@ import { App } from "../../src/app/app"
|
|
|
import { GlobTool } from "../../src/tool/glob"
|
|
import { GlobTool } from "../../src/tool/glob"
|
|
|
import { ListTool } from "../../src/tool/ls"
|
|
import { ListTool } from "../../src/tool/ls"
|
|
|
|
|
|
|
|
|
|
+const ctx = {
|
|
|
|
|
+ sessionID: "test",
|
|
|
|
|
+ messageID: "",
|
|
|
|
|
+ abort: AbortSignal.any([]),
|
|
|
|
|
+ metadata: () => {},
|
|
|
|
|
+}
|
|
|
describe("tool.glob", () => {
|
|
describe("tool.glob", () => {
|
|
|
test("truncate", async () => {
|
|
test("truncate", async () => {
|
|
|
await App.provide({ cwd: process.cwd() }, async () => {
|
|
await App.provide({ cwd: process.cwd() }, async () => {
|
|
@@ -11,11 +17,7 @@ describe("tool.glob", () => {
|
|
|
pattern: "./node_modules/**/*",
|
|
pattern: "./node_modules/**/*",
|
|
|
path: undefined,
|
|
path: undefined,
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- sessionID: "test",
|
|
|
|
|
- messageID: "",
|
|
|
|
|
- abort: AbortSignal.any([]),
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ ctx,
|
|
|
)
|
|
)
|
|
|
expect(result.metadata.truncated).toBe(true)
|
|
expect(result.metadata.truncated).toBe(true)
|
|
|
})
|
|
})
|
|
@@ -27,11 +29,7 @@ describe("tool.glob", () => {
|
|
|
pattern: "*.json",
|
|
pattern: "*.json",
|
|
|
path: undefined,
|
|
path: undefined,
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- sessionID: "test",
|
|
|
|
|
- messageID: "",
|
|
|
|
|
- abort: AbortSignal.any([]),
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ ctx,
|
|
|
)
|
|
)
|
|
|
expect(result.metadata).toMatchObject({
|
|
expect(result.metadata).toMatchObject({
|
|
|
truncated: false,
|
|
truncated: false,
|
|
@@ -46,11 +44,7 @@ describe("tool.ls", () => {
|
|
|
const result = await App.provide({ cwd: process.cwd() }, async () => {
|
|
const result = await App.provide({ cwd: process.cwd() }, async () => {
|
|
|
return await ListTool.execute(
|
|
return await ListTool.execute(
|
|
|
{ path: "./example", ignore: [".git"] },
|
|
{ path: "./example", ignore: [".git"] },
|
|
|
- {
|
|
|
|
|
- sessionID: "test",
|
|
|
|
|
- messageID: "",
|
|
|
|
|
- abort: AbortSignal.any([]),
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ ctx,
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
expect(result.output).toMatchSnapshot()
|
|
expect(result.output).toMatchSnapshot()
|