aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/tests/sietima/message.t41
1 files changed, 41 insertions, 0 deletions
diff --git a/t/tests/sietima/message.t b/t/tests/sietima/message.t
new file mode 100644
index 0000000..8b42ff8
--- /dev/null
+++ b/t/tests/sietima/message.t
@@ -0,0 +1,41 @@
+#!perl
+use strict;
+use warnings;
+use 5.020;
+use lib 't/lib';
+use Test2::Bundle::Extended;
+use Test2::Tools::MoreCompare qw(bag);
+use Test2::Plugin::DieOnFail;
+use Email::Stuffer;
+use Data::Printer;
+use Sietima::Message;
+
+my $mail = Email::Stuffer
+ ->from('one@example.com')
+ ->to('two@example, three@example.com')
+ ->text_body('test message')->email;
+
+my $message = Sietima::Message->new({
+ mail => $mail,
+ from => 'one@envelope.example.com',
+ to => [
+ 'two@envelope.example.com',
+ 'three@envelope.example.com',
+ ],
+});
+
+is(
+ $message->envelope,
+ {
+ from => 'one@envelope.example.com',
+ to => bag {
+ item 'two@envelope.example.com';
+ item 'three@envelope.example.com';
+ },
+ },
+ 'the envelope should be built from the attributes',
+);
+
+# I'm not sure I'll need 'clone', so I won't test it for the moment
+
+done_testing;