mirror of
https://github.com/penpot/penpot.git
synced 2026-11-03 08:30:40 +00:00
🐛 Remove stale duplicated websocket negotiation tests
The listener-options commit renamed the test aliases (http.ws for app.http.websocket, ws for app.util.websocket) and added corrected copies of the resolve-encoder, resolve-decoder and normalize-message tests, but left the old ws-qualified block behind. Those vars do not exist on app.util.websocket, so the namespace did not compile, and the duplicated deftest names meant only the last copy would run anyway. Delete the stale block. AI-assisted-by: muse-spark-1.3-contributor
This commit is contained in:
parent
f1b0e07a8d
commit
7adcb23f33
@ -150,71 +150,6 @@
|
||||
((get-method http.ws/handle-message :pointer-update)
|
||||
cfg empty-wsp msg)))))))
|
||||
|
||||
(t/deftest resolve-encoder-defaults-to-transit
|
||||
(let [encode (ws/resolve-encoder :transit)
|
||||
msg {:type :join-file
|
||||
:file-id (uuid/next)
|
||||
:profile-id (uuid/next)}]
|
||||
(t/is (= msg (tr/decode-str (encode msg))))))
|
||||
|
||||
(t/deftest resolve-encoder-unexpected-format-falls-back-to-transit
|
||||
(let [encode (ws/resolve-encoder :foo)
|
||||
msg {:type :join-file :file-id (uuid/next)}]
|
||||
(t/is (= msg (tr/decode-str (encode msg))))))
|
||||
|
||||
(t/deftest resolve-encoder-json
|
||||
(let [encode (ws/resolve-encoder :json)
|
||||
file-id (uuid/next)
|
||||
encoded (encode {:type :join-file :file-id file-id})]
|
||||
(t/is (string? encoded))
|
||||
(t/is (= "join-file" (get (json/decode encoded) "type")))
|
||||
(t/is (= (str file-id) (get (json/decode encoded) "fileId")))))
|
||||
|
||||
(t/deftest resolve-decoder-defaults-to-transit
|
||||
(let [decode (ws/resolve-decoder :transit)
|
||||
msg {:type :subscribe-file :file-id (uuid/next)}]
|
||||
(t/is (= msg (decode (tr/encode-str msg {:type :json-verbose}))))))
|
||||
|
||||
(t/deftest resolve-decoder-unexpected-format-falls-back-to-transit
|
||||
(let [decode (ws/resolve-decoder :foo)
|
||||
msg {:type :subscribe-file :file-id (uuid/next)}]
|
||||
(t/is (= msg (decode (tr/encode-str msg {:type :json-verbose}))))))
|
||||
|
||||
(t/deftest resolve-decoder-json
|
||||
(let [decode (ws/resolve-decoder :json)
|
||||
file-id (uuid/next)
|
||||
decoded (decode (str "{\"type\":\"subscribe-file\","
|
||||
"\"fileId\":\"" file-id "\"}"))]
|
||||
(t/is (= "subscribe-file" (:type decoded)))
|
||||
(t/is (= (str file-id) (:file-id decoded)))))
|
||||
|
||||
(t/deftest normalize-message-from-json-decoding
|
||||
(let [file-id (uuid/next)
|
||||
decoded {:type "subscribe-file"
|
||||
:file-id (str file-id)}
|
||||
message (ws/normalize-message decoded)]
|
||||
(t/is (= :subscribe-file (:type message)))
|
||||
(t/is (uuid? (:file-id message)))
|
||||
(t/is (= file-id (:file-id message)))))
|
||||
|
||||
(t/deftest normalize-message-noop-for-transit-decoding
|
||||
(let [file-id (uuid/next)
|
||||
decoded {:type :subscribe-file :file-id file-id}]
|
||||
(t/is (= decoded (ws/normalize-message decoded)))))
|
||||
|
||||
(t/deftest normalize-message-with-invalid-uuid
|
||||
(let [message (ws/normalize-message
|
||||
{:type "subscribe-file" :file-id "invalid"})]
|
||||
(t/is (= :subscribe-file (:type message)))
|
||||
(t/is (nil? (:file-id message)))))
|
||||
|
||||
(t/deftest normalize-message-team-id
|
||||
(let [team-id (uuid/next)
|
||||
message (ws/normalize-message
|
||||
{:type "subscribe-team" :team-id (str team-id)})]
|
||||
(t/is (= :subscribe-team (:type message)))
|
||||
(t/is (= team-id (:team-id message)))))
|
||||
|
||||
(t/deftest resolve-encoder-defaults-to-transit
|
||||
(let [encode (http.ws/resolve-encoder :transit)
|
||||
msg {:type :join-file
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user