feat: integrate SSE with message reception pipeline
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
;;; noise-receive-poll-test.el --- Tests for the receive poller -*- lexical-binding: t; -*-
|
||||
|
||||
(require 'ert)
|
||||
(require 'noise-receive)
|
||||
|
||||
(ert-deftest noise-receive--poll-surfaces-error-once ()
|
||||
"A failing poll messages the user once, not on every retry."
|
||||
(let ((noise-receive--last-poll-error nil)
|
||||
(messages nil))
|
||||
(cl-letf (((symbol-function 'noise-receive)
|
||||
(lambda ()
|
||||
(signal 'noise-rpc-error
|
||||
'("signal-cli error -32602: Method requires valid account parameter"))))
|
||||
((symbol-function 'message)
|
||||
(lambda (fmt &rest args)
|
||||
(push (apply #'format fmt args) messages))))
|
||||
(noise-receive--poll)
|
||||
(noise-receive--poll))
|
||||
(should (= 1 (length messages)))
|
||||
(should (string-match-p "account parameter" (car messages)))
|
||||
;; the hint points at the fix
|
||||
(should (string-match-p "noise-select-account" (car messages)))))
|
||||
|
||||
(ert-deftest noise-receive--poll-recovers-and-resets ()
|
||||
"After a successful poll, a recurring error is shown again."
|
||||
(let ((noise-receive--last-poll-error nil)
|
||||
(messages nil)
|
||||
(fail t))
|
||||
(cl-letf (((symbol-function 'noise-receive)
|
||||
(lambda ()
|
||||
(when fail
|
||||
(signal 'noise-rpc-error '("connection refused")))
|
||||
0))
|
||||
((symbol-function 'message)
|
||||
(lambda (fmt &rest args)
|
||||
(push (apply #'format fmt args) messages))))
|
||||
(noise-receive--poll) ; error -> message
|
||||
(setq fail nil)
|
||||
(noise-receive--poll) ; success -> resets
|
||||
(setq fail t)
|
||||
(noise-receive--poll)) ; error again -> message again
|
||||
(should (= 2 (length messages)))))
|
||||
Reference in New Issue
Block a user