-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aefb383
commit 88e9562
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,40 @@ | ||
(ns r-place-backend.core-test | ||
(:require [clojure.test :refer :all] | ||
[gniazdo.core :as ws] | ||
[r-place-backend.core :refer :all])) | ||
|
||
(deftest a-test | ||
(testing "FIXME, I fail." | ||
(is (= 0 1)))) | ||
|
||
|
||
(comment | ||
|
||
;; @TODO Server setup for test | ||
(let [b-socket (ws/connect | ||
"ws://localhost:8080/ws" | ||
:on-receive #(prn 'received %)) | ||
socket-xs (mapv (fn [_] | ||
(let [a (atom nil)] | ||
{:socket (ws/connect | ||
"ws://localhost:8080/ws" | ||
:on-receive #(reset! a %)) | ||
:data-received a})) | ||
(range 10)) | ||
test-data {:column (rand-int 20) | ||
:row (rand-int 20), | ||
:color (rand-nth ["red" "blue" "green" "cyan"])}] | ||
(ws/send-msg b-socket (pr-str test-data)) | ||
|
||
(ws/close b-socket) | ||
(doseq [s (map :socket socket-xs)] | ||
(ws/close s)) | ||
|
||
(every? (fn [x] | ||
(= (read-string x) | ||
["pixel" test-data])) | ||
(map (comp deref :data-received) | ||
socket-xs))) | ||
;; Setup multiple connections to listen to the broadcast | ||
;; Assert that the broadcast is successful | ||
) |