Skip to content

Commit 5e56add

Browse files
committed
Updated tests.
1 parent 58fe983 commit 5e56add

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

deps.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{:paths ["src" "resources"]
1+
{:paths ["test" "src" "resources"]
22
:deps {org.clojure/clojure {:mvn/version "1.12.1"}
33
org.clojure/core.async {:mvn/version "1.8.741"}
44
org.babashka/cli {:mvn/version "0.8.65"}

test/eca/features/chat_tool_call_state_test.clj

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@
140140
(is (= 1 (count prepare-messages)) "Expected exactly one toolCallPrepare notification to be sent")
141141

142142
(is (match? {:chat-id chat-id
143-
:request-id "req-1"
144143
:role :assistant
145144
:content (merge {:type :toolCallPrepare
146145
:id tool-call-id}
@@ -301,7 +300,7 @@
301300
;; Step 4: :waiting-approval -> :execution-approved (user approves)
302301
(let [result (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :user-approve)]
303302
(is (match? {:status :execution-approved
304-
:actions [:deliver-approval-true]}
303+
:actions [:set-decision-reason :deliver-approval-true]}
305304
result)
306305
"Expected transition to :execution-approved with deliver approval true action")
307306

@@ -341,7 +340,7 @@
341340
;; Step 3: :check-approval -> :execution-approved (auto approval)
342341
(let [result (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :config-allow)]
343342
(is (match? {:status :execution-approved
344-
:actions [:deliver-approval-true]}
343+
:actions [:set-decision-reason :deliver-approval-true]}
345344
result)
346345
"Expected transition to :execution-approved with deliver approval true action")
347346

@@ -369,7 +368,7 @@
369368

370369
(let [result (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :user-reject)]
371370
(is (match? {:status :rejected
372-
:actions [:deliver-approval-false :log-rejection]}
371+
:actions [:set-decision-reason :deliver-approval-false :log-rejection]}
373372
result)
374373
"Expected transition to :rejected with deliver approval false and log rejection actions")
375374

@@ -430,7 +429,7 @@
430429
result (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :execution-end result-data)]
431430

432431
(is (match? {:status :completed
433-
:actions [:send-toolCalled :record-metrics]}
432+
:actions [:send-toolCalled :log-metrics]}
434433
result)
435434
"Expected transition to :completed with send toolCalled and record metrics actions")
436435

@@ -445,7 +444,6 @@
445444
(is (= 1 (count completed-messages)) "Expected exactly one toolCalled notification to be sent")
446445

447446
(is (match? {:chat-id chat-id
448-
:request-id "req-1"
449447
:role :assistant
450448
:content (merge {:type :toolCalled
451449
:id tool-call-id}
@@ -535,13 +533,13 @@
535533

536534
(let [result (#'f.chat/transition-tool-call! db* chat-ctx "tool-1" :stop-requested)]
537535
(is (match? {:status :stopped
538-
:actions [:send-toolCallRejected]}
536+
:actions [:set-decision-reason :send-toolCallRejected]}
539537
result)
540538
"Expected transition to :stopped with send toolCallRejected action")
541539
(is (= :stopped (:status (#'f.chat/get-tool-call-state @db* chat-id "tool-1")))
542540
"Expected tool call state to be in :stopped status")))
543541

544-
(testing ":waiting-approval -> :stopped"
542+
(testing ":waiting-approval -> :rejected"
545543
(let [approved?* (promise)]
546544
(#'f.chat/transition-tool-call! db* chat-ctx "tool-2" :tool-prepare
547545
{:name "test" :origin "test" :arguments-text "{}"})
@@ -551,8 +549,8 @@
551549
{:state :running :text "Waiting"})
552550

553551
(let [result (#'f.chat/transition-tool-call! db* chat-ctx "tool-2" :stop-requested)]
554-
(is (match? {:status :stopped
555-
:actions [:deliver-approval-false]}
552+
(is (match? {:status :rejected
553+
:actions [:set-decision-reason :deliver-approval-false]}
556554
result)
557555
"Expected transition to :stopped with deliver approval false action")
558556
(is (= :stopped (:status (#'f.chat/get-tool-call-state @db* chat-id "tool-2")))
@@ -731,7 +729,7 @@
731729

732730
(let [result (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :config-allow)]
733731
(is (match? {:status :execution-approved
734-
:actions [:deliver-approval-true]}
732+
:actions [:set-decision-reason :deliver-approval-true]}
735733
result)
736734
"Expected transition to :execution-approved with deliver approval true action")
737735

@@ -815,7 +813,7 @@
815813
result (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :execution-end error-result)]
816814

817815
(is (match? {:status :completed
818-
:actions [:send-toolCalled :record-metrics]}
816+
:actions [:send-toolCalled :log-metrics]}
819817
result)
820818
"Expected transition to :completed with send toolCalled and record metrics actions")
821819

0 commit comments

Comments
 (0)