mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 09:44:21 +01:00
sync
This commit is contained in:
17
packages/opencode/test/tool/__snapshots__/tool.test.ts.snap
Normal file
17
packages/opencode/test/tool/__snapshots__/tool.test.ts.snap
Normal file
@@ -0,0 +1,17 @@
|
||||
// Bun Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`tool.ls basic 1`] = `
|
||||
"- /home/thdxr/dev/projects/sst/opencode/js/example/
|
||||
- home/
|
||||
- thdxr/
|
||||
- dev/
|
||||
- projects/
|
||||
- sst/
|
||||
- opencode/
|
||||
- js/
|
||||
- example/
|
||||
- ink.tsx
|
||||
- broken.ts
|
||||
- cli.ts
|
||||
"
|
||||
`;
|
||||
55
packages/opencode/test/tool/tool.test.ts
Normal file
55
packages/opencode/test/tool/tool.test.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { App } from "../../src/app/app";
|
||||
import { glob } from "../../src/tool/glob";
|
||||
import { ls } from "../../src/tool/ls";
|
||||
|
||||
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: 2,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("tool.ls", () => {
|
||||
test("basic", async () => {
|
||||
const result = await App.provide({ directory: process.cwd() }, async () => {
|
||||
return await ls.execute(
|
||||
{
|
||||
path: "./example",
|
||||
},
|
||||
{
|
||||
toolCallId: "test",
|
||||
messages: [],
|
||||
},
|
||||
);
|
||||
});
|
||||
expect(result.output).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user