aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2016-06-10 15:59:49 +0100
committerdakkar <dakkar@thenautilus.net>2016-06-10 15:59:49 +0100
commit7b2bbcf10cab05962e0d128c285e0201401d2e14 (patch)
tree2e376fcaaac563eff3f03147ab5be7a8ab2d13fc /t
parentmove Test2::* tests to subdir (diff)
downloadSietima-7b2bbcf10cab05962e0d128c285e0201401d2e14.tar.gz
Sietima-7b2bbcf10cab05962e0d128c285e0201401d2e14.tar.bz2
Sietima-7b2bbcf10cab05962e0d128c285e0201401d2e14.zip
some Message tests
also, a probably useless ->clone
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;