File tree Expand file tree Collapse file tree 3 files changed +44
-1
lines changed
Expand file tree Collapse file tree 3 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 44 [integration.eca :as eca]))
55
66(def namespaces
7- '[integration.initialize-test])
7+ '[integration.initialize-test
8+ integration.chat-openai-test])
89
910(defn timeout [timeout-ms callback]
1011 (let [fut (future (callback ))
Original file line number Diff line number Diff line change 1+ (ns integration.chat-openai-test
2+ (:require
3+ [clojure.test :refer [deftest is testing]]
4+ [integration.eca :as eca]
5+ [integration.fixture :as fixture]
6+ [matcher-combinators.matchers :as m]
7+ [matcher-combinators.test :refer [match?]]))
8+
9+ (eca/clean-after-test )
10+
11+ (deftest simple-text
12+ (eca/start-process! )
13+
14+ (eca/request! (fixture/initialize-request ))
15+ (eca/notify! (fixture/initialized-notification ))
16+ (testing " simple hello message with reply"
17+ (let [resp (eca/request! (fixture/chat-prompt-request
18+ {:request-id 0
19+ :message " Hello there!" }))
20+ chat-id (:chatId resp)]
21+
22+ (is (match?
23+ {:chatId (m/pred string?)
24+ :model " claude-sonnet-4-20250514"
25+ :status " success" }
26+ resp))
27+
28+ (is (match?
29+ {:chatId chat-id
30+ :requestId 0
31+ :role " user"
32+ :content {:type " text" :text " Hello there!\n " }}
33+ (eca/client-awaits-server-notification :chat/contentReceived )))
34+ (is (match?
35+ {:chatId chat-id
36+ :requestId 0
37+ :role " system"
38+ :content {:type " progress" :state " running" :text " Waiting model" }}
39+ (eca/client-awaits-server-notification :chat/contentReceived ))))))
Original file line number Diff line number Diff line change 2626
2727(defn exit-notification []
2828 [:exit {}])
29+
30+ (defn chat-prompt-request [params]
31+ [:chat/prompt params])
You can’t perform that action at this time.
0 commit comments