summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2026-04-25 16:29:41 -0300
committerEuAndreh <eu@euandre.org>2026-04-25 16:29:41 -0300
commit8cc994ce42ab7b0d69a1c246f1106c7443d4142a (patch)
tree05c924db4210c6a29df07124bd68ac48315e6d90 /tests
parentSplit RPL_ISUPPORT to stay under 15 params per line (diff)
downloadpapod-8cc994ce42ab7b0d69a1c246f1106c7443d4142a.tar.gz
papod-8cc994ce42ab7b0d69a1c246f1106c7443d4142a.tar.xz
Add integration tests for invite-only, ISUPPORT, OPER
End-to-end coverage for the recently added features: - +i mode rejects JOIN with 473 and INVITE clears the gate - the welcome 005 line carries PREFIX/CHANTYPES/CASEMAPPING - OPER answers with 381 plus the explicit MODE +o line
Diffstat (limited to 'tests')
-rw-r--r--tests/integration.clj59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/integration.clj b/tests/integration.clj
index 04efc72..39993dc 100644
--- a/tests/integration.clj
+++ b/tests/integration.clj
@@ -499,6 +499,65 @@
((:close! alice))
((:close! bob))))))
+(deftest test_invite-only-channel
+ (let [components (test-components)
+ alice (make-client components)
+ bob (make-client components)]
+ (try
+ (register! alice "alice" (:net-id components))
+ (wait-for alice "001" 2000)
+ (register! bob "bob" (:net-id components))
+ (wait-for bob "001" 2000)
+ ;; Alice creates and locks channel
+ (send! alice "JOIN #priv")
+ (wait-for alice "JOIN" 2000)
+ (send! alice "MODE #priv +i")
+ (Thread/sleep 100)
+ ;; Bob tries to JOIN — denied
+ (send! bob "JOIN #priv")
+ (let [out (wait-for bob "473" 2000)]
+ (is (string/includes? out "473"))
+ (is (string/includes? out "+i")))
+ ;; Alice invites bob
+ (.reset (:client-out bob))
+ (send! alice "INVITE bob #priv")
+ (wait-for bob "INVITE" 2000)
+ ;; Bob can now join
+ (.reset (:client-out bob))
+ (send! bob "JOIN #priv")
+ (let [out (wait-for bob "JOIN" 2000)]
+ (is (string/includes? out "JOIN"))
+ (is (not (string/includes? out "473"))))
+ (finally
+ ((:close! alice))
+ ((:close! bob))))))
+
+(deftest test_isupport-005
+ (let [components (test-components)
+ client (make-client components)]
+ (try
+ (register! client "alice" (:net-id components))
+ (let [out (wait-for client "PREFIX=" 2000)]
+ (is (string/includes? out "PREFIX=(ov)@+"))
+ (is (string/includes? out "CHANTYPES=#"))
+ (is (string/includes? out "CASEMAPPING=ascii")))
+ (finally
+ ((:close! client))))))
+
+(deftest test_oper-success
+ (let [components (test-components)
+ client (make-client components)]
+ (try
+ (register! client "baz" (:net-id components))
+ (wait-for client "001" 2000)
+ (.reset (:client-out client))
+ (send! client "OPER operuser operpassword")
+ (let [out (wait-for client "MODE" 2000)]
+ (is (string/includes? out "381"))
+ (is (re-find #"MODE baz :?\+o" out)))
+ (finally
+ ((:close! client))))))
+
(defn -main
[& _args]
(binding [*out* *err*]