Some testing and fixing receiving messages over SSE
This commit is contained in:
@@ -189,3 +189,22 @@
|
||||
"timestamp" 1717930000000
|
||||
"message" "new message here")))
|
||||
(should (string-match-p "Sarah> new message here" (buffer-string))))))
|
||||
|
||||
(ert-deftest noise-receive-handle-sse-event-stores-message ()
|
||||
"An SSE envelope event stores the message and refreshes the open buffer."
|
||||
(noise-receive-test--with-db
|
||||
(noise-db-upsert-conversation "+1" :type "direct" :name "Sarah"
|
||||
:members '("+1"))
|
||||
(require 'noise-conversation)
|
||||
(with-current-buffer (noise-conversation-open "+1")
|
||||
(noise-receive--handle-sse-event
|
||||
(noise-receive-test--ht
|
||||
"envelope"
|
||||
(noise-receive-test--ht
|
||||
"sourceNumber" "+1" "sourceName" "Sarah"
|
||||
"dataMessage" (noise-receive-test--ht
|
||||
"timestamp" 1717930000000
|
||||
"message" "from sse"))))
|
||||
(should (string-match-p "Sarah> from sse" (buffer-string))))
|
||||
(let ((msg (car (noise-db-get-messages "+1"))))
|
||||
(should (string= "from sse" (gethash "body" msg))))))
|
||||
|
||||
Reference in New Issue
Block a user