summaryrefslogtreecommitdiffhomepage
path: root/js/test/tool
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-05-26 14:09:17 -0400
committerDax Raad <[email protected]>2025-05-26 14:09:17 -0400
commit80555f13e052443dc9dc67811bf782a3146de512 (patch)
tree9219001cf50a23032ad968fc036053dfd223b65e /js/test/tool
parent113c49457fd6e37d517e2d212e2e6eb21084b4fb (diff)
downloadopencode-80555f13e052443dc9dc67811bf782a3146de512.tar.gz
opencode-80555f13e052443dc9dc67811bf782a3146de512.zip
more tools
Diffstat (limited to 'js/test/tool')
-rw-r--r--js/test/tool/__snapshots__/tool.test.ts.snap66
-rw-r--r--js/test/tool/tool.test.ts18
2 files changed, 84 insertions, 0 deletions
diff --git a/js/test/tool/__snapshots__/tool.test.ts.snap b/js/test/tool/__snapshots__/tool.test.ts.snap
new file mode 100644
index 000000000..6b6d8d61f
--- /dev/null
+++ b/js/test/tool/__snapshots__/tool.test.ts.snap
@@ -0,0 +1,66 @@
+// Bun Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`tool.ls basic 1`] = `
+"- /home/thdxr/dev/projects/sst/opencode/js/
+ - home/
+ - thdxr/
+ - dev/
+ - projects/
+ - sst/
+ - opencode/
+ - js/
+ - package.json
+ - schema.json
+ - tsconfig.json
+ - test/
+ - tool/
+ - tool.test.ts
+ - example/
+ - ink.tsx
+ - cli.ts
+ - scrap.ts
+ - README.md
+ - bun.lock
+ - src/
+ - lsp/
+ - client.ts
+ - index.ts
+ - language.ts
+ - server/
+ - server.ts
+ - storage/
+ - storage.ts
+ - app/
+ - index.ts
+ - path.ts
+ - config.ts
+ - share/
+ - share.ts
+ - tool/
+ - bash.ts
+ - glob.ts
+ - tool.ts
+ - ls.ts
+ - util/
+ - file-times.ts
+ - view.ts
+ - index.ts
+ - edit.ts
+ - llm/
+ - llm.ts
+ - util/
+ - context.ts
+ - scrap.ts
+ - event.ts
+ - log.ts
+ - index.ts
+ - id/
+ - id.ts
+ - bus/
+ - index.ts
+ - session/
+ - session.ts
+ - prompt/
+ - anthropic.txt
+"
+`;
diff --git a/js/test/tool/tool.test.ts b/js/test/tool/tool.test.ts
index 4e9daf152..8f69f7b59 100644
--- a/js/test/tool/tool.test.ts
+++ b/js/test/tool/tool.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, test } from "bun:test";
import { App } from "../../src/app";
import { glob } from "../../src/tool/glob";
+import { ls } from "../../src/tool/ls";
describe("tool.glob", () => {
test("truncate", async () => {
@@ -35,3 +36,20 @@ describe("tool.glob", () => {
});
});
});
+
+describe("tool.ls", () => {
+ test("basic", async () => {
+ const result = await App.provide({ directory: process.cwd() }, async () => {
+ return await ls.execute(
+ {
+ path: ".",
+ },
+ {
+ toolCallId: "test",
+ messages: [],
+ },
+ );
+ });
+ expect(result.output).toMatchSnapshot();
+ });
+});