summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit.clj14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/unit.clj b/tests/unit.clj
index fad96fc..b2cea4c 100644
--- a/tests/unit.clj
+++ b/tests/unit.clj
@@ -374,8 +374,8 @@
:clients (atom {"alice" {:w alice-out}})
:channels (atom {}))
sender (registered-client "alice" alice-out test-network-id)
- conn (:conn components)]
- (handle-join ["#test"] sender components)
+ conn (:conn components)
+ replies (handle-join ["#test"] sender components)]
(let [db (d/db conn)]
;; Channel entity created
(is (some? (resolve-channel db "#test")))
@@ -396,8 +396,8 @@
(is (= #{["user-join" "alice" "#test"]} events))))
;; In-memory updated
(is (= #{"alice"} (get @(:channels components) "#test")))
- ;; Notification delivered
- (is (string/includes? (.toString alice-out "UTF-8") "JOIN #test"))))
+ ;; Notification returned in replies
+ (is (some #(string/includes? % "JOIN #test") replies))))
(testing "second JOIN reuses existing channel"
(let [alice-out (java.io.ByteArrayOutputStream.)
bob-out (java.io.ByteArrayOutputStream.)
@@ -815,7 +815,7 @@
handle (str "&" chan-id)]
;; Alice (owner) can join
(let [replies (handle-join [handle] alice components)]
- (is (empty? replies))
+ (is (some #(string/includes? % "JOIN") replies))
(is (contains? (get @(:channels components) handle) "alice")))
;; Bob (no access) cannot join — gets "No such channel"
(let [replies (handle-join [handle] bob components)]
@@ -838,7 +838,7 @@
(assoc components :channels (atom {})))]
;; Creates a NEW public channel named #bob-firing-wg
;; (doesn't find the private one — that's the point)
- (is (empty? replies)))))
+ (is (some #(string/includes? % "JOIN") replies)))))
(testing "#-prefixed UUID name works as a normal public channel"
(let [{:keys [test-network-id] :as components}
(assoc (test-components-with-network)
@@ -851,7 +851,7 @@
(let [c (assoc components
:clients (atom {"alice" {:w out}}))]
(let [replies (handle-join [uuid-name] alice c)]
- (is (empty? replies))
+ (is (some #(string/includes? % "JOIN") replies))
(is (contains? (get @(:channels c) uuid-name) "alice"))))))
(testing "&non-uuid is rejected"
(let [{:keys [test-network-id] :as components}