Skip to content

Commit bdda420

Browse files
committed
Add test
1 parent 6b53c83 commit bdda420

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/integration/integration-tests.el

+24
Original file line numberDiff line numberDiff line change
@@ -616,3 +616,27 @@ If CLI-COMMAND is nil, then use the default."
616616
;; wait for the REPL to exit
617617
(cider-itu-poll-until (not (eq (process-status nrepl-proc) 'run)) 15)
618618
(expect (member (process-status nrepl-proc) '(exit signal)))))))))))
619+
620+
(describe "cider-connect-default-params"
621+
(it "bypasses cider-connect user prompts"
622+
(let (host-prompt port-prompt)
623+
(spy-on 'cider--completing-read-host
624+
:and-call-fake (lambda (_) (setq host-prompt t)))
625+
(spy-on 'cider--completing-read-host
626+
:and-call-fake (lambda (_) (setq port-prompt t)))
627+
(with-temp-buffer
628+
(setq-local cider-connect-default-params '(:host "localhost"))
629+
(ignore-errors (call-interactively 'cider-connect))
630+
(expect host-prompt :to-equal nil)
631+
(expect port-prompt :to-equal t))
632+
(with-temp-buffer
633+
(setq host-prompt nil port-prompt nil)
634+
(setq-local cider-connect-default-params
635+
'(:host "localhost" :port 65536))
636+
(condition-case e
637+
(call-interactively 'cider-connect)
638+
(error
639+
(expect e :to-equal
640+
'(error "[nREPL] Direct connection to localhost:65536 failed"))))
641+
(expect host-prompt :to-equal nil)
642+
(expect port-prompt :to-equal nil)))))

0 commit comments

Comments
 (0)