Skip to content

Commit 8e8632a

Browse files
committed
Fix tests
1 parent decdb0e commit 8e8632a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

test/eca/features/tools/filesystem_test.clj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
{:contents [{:type :text
2424
:error true
2525
:content "Access denied - path outside workspace root, call list_allowed_dirs first"}]}
26-
((get-in f.tools.filesystem/definitions ["list_directory" :handler])
27-
{"path" (h/file-path "/foo/qux")}
28-
{:workspace-folders [{:uri (h/file-uri "file:///foo/bar/baz") :name "baz"}]}))))
26+
(with-redefs [fs/canonicalize (constantly (h/file-path "/foo/qux"))]
27+
((get-in f.tools.filesystem/definitions ["list_directory" :handler])
28+
{"path" (h/file-path "/foo/qux")}
29+
{:workspace-folders [{:uri (h/file-uri "file:///foo/bar/baz") :name "baz"}]})))))
2930
(testing "allowed dir"
3031
(is (match?
3132
{:contents [{:type :text
@@ -37,7 +38,8 @@
3738
(with-redefs [fs/starts-with? (constantly true)
3839
fs/list-dir (constantly [(fs/path (h/file-path "/foo/bar/baz/some.clj"))
3940
(fs/path (h/file-path "/foo/bar/baz/qux"))])
40-
fs/directory? (fn [path] (not (string/ends-with? (str path) ".clj")))]
41+
fs/directory? (fn [path] (not (string/ends-with? (str path) ".clj")))
42+
fs/canonicalize (constantly (h/file-path "/foo/bar/baz"))]
4143
((get-in f.tools.filesystem/definitions ["list_directory" :handler])
4244
{"path" (h/file-path "/foo/bar/baz")}
4345
{:workspace-folders [{:uri (h/file-uri "file:///foo/bar/baz") :name "baz"}]}))))))

test/eca/features/tools_test.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
:description string?
2626
:parameters some?
2727
:source :built-in}])
28-
(f.tools/all-tools {} {:built-in-tools {:filesystem {:enabled true}}}))))
28+
(f.tools/all-tools {} {:builtInTools {:filesystem {:enabled true}}}))))
2929
(testing "Do not include disabled built-in tools"
3030
(is (match?
3131
(m/embeds [(m/mismatch {:name "list_directory"})])
32-
(f.tools/all-tools {} {:built-in-tools {:filesystem {:enabled false}}})))))
32+
(f.tools/all-tools {} {:builtInTools {:filesystem {:enabled false}}})))))

0 commit comments

Comments
 (0)