Skip to content

Commit 56883c1

Browse files
committed
Fix tests
1 parent cdcce02 commit 56883c1

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

test/eca/features/tools/filesystem_test.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
(is (match?
2323
{:contents [{:type :text
2424
:error true
25-
:content "/foo/qux is not a valid path"}]}
25+
:content (str (h/file-path "/foo/qux") " is not a valid path")}]}
2626
(with-redefs [fs/canonicalize (constantly (h/file-path "/foo/qux"))
2727
fs/exists? (constantly false)]
2828
((get-in f.tools.filesystem/definitions ["list_directory" :handler])
@@ -32,7 +32,7 @@
3232
(is (match?
3333
{:contents [{:type :text
3434
:error true
35-
:content "Access denied - path /foo/qux outside allowed directories"}]}
35+
:content (format "Access denied - path %s outside allowed directories" (h/file-path "/foo/qux"))}]}
3636
(with-redefs [fs/canonicalize (constantly (h/file-path "/foo/qux"))
3737
fs/exists? (constantly true)]
3838
((get-in f.tools.filesystem/definitions ["list_directory" :handler])
@@ -61,7 +61,7 @@
6161
(is (match?
6262
{:contents [{:type :text
6363
:error true
64-
:content "File /foo/qux is not readable"}]}
64+
:content (format "File %s is not readable" (h/file-path "/foo/qux"))}]}
6565
(with-redefs [fs/exists? (constantly true)
6666
fs/readable? (constantly false)
6767
f.tools.filesystem/allowed-path? (constantly true)]

test/eca/llm_providers/anthropic_test.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
(deftest ->messages-with-history-test
88
(testing "no previous history"
99
(is (match?
10-
[{:role "user" :content "Hey" :cache_control {:type "ephemeral"}}]
10+
[{:role "user" :content [{:type :text :text "Hey" :cache_control {:type "ephemeral"}}]}]
1111
(#'llm-providers.anthropic/->messages-with-history [] "Hey"))))
1212
(testing "With basic text history"
1313
(is (match?
1414
[{:role "user" :content "Count with me: 1"}
1515
{:role "assistant" :content "2"}
16-
{:role "user" :content "3" :cache_control {:type "ephemeral"}}]
16+
{:role "user" :content [{:type :text :text "3" :cache_control {:type "ephemeral"}}]}]
1717
(#'llm-providers.anthropic/->messages-with-history
1818
[{:role "user" :content "Count with me: 1"}
1919
{:role "assistant" :content "2"}]
@@ -30,7 +30,7 @@
3030
:tool-use-id "call-1"
3131
:content "Allowed directories: /foo/bar\n"}]}
3232
{:role "assistant" :content "I see /foo/bar"}
33-
{:role "user" :content "Thanks" :cache_control {:type "ephemeral"}}]
33+
{:role "user" :content [{:type :text :text "Thanks" :cache_control {:type "ephemeral"}}]}]
3434
(#'llm-providers.anthropic/->messages-with-history
3535
[{:role "user" :content "List the files you are allowed"}
3636
{:role "assistant" :content "Ok!"}

0 commit comments

Comments
 (0)