Skip to content

Commit f519c4e

Browse files
committed
Adds tests for sending message to cc and bcc recipients
1 parent 882a76a commit f519c4e

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

rosetta-test-suites/sendmail.ros

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,29 @@
176176
(server-requests-with-command server "MAIL"))
177177
(string-append "Expected client to send empty sender: " (server-requests-with-command server "MAIL"))))))
178178

179-
; TODO: CC and BCC
179+
(test "Send a message to cc recipients" (lambda ()
180+
(let
181+
((responses (sendmail-send-message-full smtp-connection "message content" "sender@sender.to" '() '("user1@recipient.to") '() (make-hash-table) '() '())))
182+
(assert (all? send-success? responses))
183+
(assert (server-message-contains? "user1@recipient.to"))
184+
(assert
185+
(any?
186+
(lambda (request)
187+
(string-prefix-ci? "TO:<user1@recipient.to>" (first (request-arguments request))))
188+
(server-requests-with-command server "RCPT"))
189+
(string-append "Expected client to send RCPT command for cc recipients: " (server-requests-with-command server "RCPT"))))))
190+
191+
(test "Send a message to bcc recipients" (lambda ()
192+
(let
193+
((responses (sendmail-send-message-full smtp-connection "message content" "sender@sender.to" '() '() '("user1@recipient.to") (make-hash-table) '() '())))
194+
(assert (all? send-success? responses))
195+
(assert (not (server-message-contains? "user1@recipient.to")))
196+
(assert
197+
(any?
198+
(lambda (request)
199+
(string-prefix-ci? "TO:<user1@recipient.to>" (first (request-arguments request))))
200+
(server-requests-with-command server "RCPT"))
201+
(string-append "Expected client to send RCPT command for bcc recipients: " (server-requests-with-command server "RCPT"))))))
180202

181203
; TODO
182204
;(test "Send message with a valid and an invalid recipient" (lambda ()

0 commit comments

Comments
 (0)