diff options
Diffstat (limited to 't/tests')
-rw-r--r-- | t/tests/sietima/role/debounce.t | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/t/tests/sietima/role/debounce.t b/t/tests/sietima/role/debounce.t new file mode 100644 index 0000000..6021f2b --- /dev/null +++ b/t/tests/sietima/role/debounce.t @@ -0,0 +1,45 @@ +#!perl +use strict; +use warnings; +use 5.020; +use lib 't/lib'; +use Test::Sietima; + +my $s = make_sietima( + with_traits => ['Debounce'], + subscribers => [ + 'one@users.example.com', + 'two@users.example.com', + ], +); + +test_sending( + sietima => $s, +); + +my $return_path = $s->return_path->address; + +is( + [ transport->deliveries ], + array { + item hash { + field email => object { + call [cast=>'Email::MIME'] => object { + call [ header_str => 'X-Been-There' ] => + match qr{\b\Q$return_path\E\b}; + }; + }; + }; + }, + 'header should be added to all messages', +); + +test_sending( + sietima => $s, + mail => { + headers => { 'x-been-there' => $return_path }, + }, + to => [], +); + +done_testing; |