aboutsummaryrefslogtreecommitdiff
path: root/t/tests/sietima/role/debounce.t
blob: 6021f2bb436f3e3c710ead3df3358cea6a4bf419 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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;