|
20 | 20 | {:db* db* :chat-id chat-id})] |
21 | 21 | (testing "returns correct response format" |
22 | 22 | (is (match? |
23 | | - {:contents [{:type :text :text test-summary}]} |
| 23 | + {:contents [{:type :text :text "Compacted successfully!"}]} |
24 | 24 | result))) |
25 | 25 |
|
26 | 26 | (testing "updates database state correctly" |
|
40 | 40 | {"summary" empty-summary} |
41 | 41 | {:db* db* :chat-id chat-id})] |
42 | 42 | (is (match? |
43 | | - {:contents [{:type :text :text empty-summary}]} |
| 43 | + {:contents [{:type :text :text "Compacted successfully!"}]} |
44 | 44 | result)) |
45 | 45 |
|
46 | 46 | (let [chat-state (get-in @db* [:chats chat-id])] |
47 | 47 | (is (= false (:compacting? chat-state))) |
48 | | - (is (= empty-summary (:last-summary chat-state))))))) |
49 | | - |
50 | | - (testing "Handles missing summary parameter gracefully" |
51 | | - (let [db* (h/db*) |
52 | | - chat-id "test-chat-789"] |
53 | | - (swap! db* assoc-in [:chats chat-id :compacting?] true) |
54 | | - |
55 | | - ;; This should not throw, but handle the missing parameter |
56 | | - (try |
57 | | - (let [result ((get-in f.tools.chat/definitions ["eca_compact_chat" :handler]) |
58 | | - {} |
59 | | - {:db* db* :chat-id chat-id})] |
60 | | - (is (match? |
61 | | - {:contents [{:type :text :text nil}]} |
62 | | - result))) |
63 | | - (catch Exception _ |
64 | | - ;; If it throws, that's also acceptable behavior for missing required parameter |
65 | | - (is true "Exception is acceptable for missing required parameter")))))) |
| 48 | + (is (= empty-summary (:last-summary chat-state)))))))) |
66 | 49 |
|
67 | 50 | (deftest compact-chat-enabled-test |
68 | 51 | (testing "Tool is enabled when chat is compacting" |
|
0 commit comments