aboutsummaryrefslogtreecommitdiff
path: root/t/tests/sietima/subscriber.t
diff options
context:
space:
mode:
Diffstat (limited to 't/tests/sietima/subscriber.t')
-rw-r--r--t/tests/sietima/subscriber.t41
1 files changed, 41 insertions, 0 deletions
diff --git a/t/tests/sietima/subscriber.t b/t/tests/sietima/subscriber.t
new file mode 100644
index 0000000..6761410
--- /dev/null
+++ b/t/tests/sietima/subscriber.t
@@ -0,0 +1,41 @@
+#!perl
+use lib 't/lib';
+use Test::Sietima;
+use Sietima::Subscriber;
+
+subtest 'simple' => sub {
+ my $s = Sietima::Subscriber->new(
+ primary => 'Gino (pino) <gino@pino.example.com>',
+ );
+
+ is(
+ $s,
+ object {
+ call address => 'gino@pino.example.com';
+ call name => 'Gino';
+ call original => 'Gino (pino) <gino@pino.example.com>';
+ call prefs => {};
+ },
+ 'construction and delegation should work',
+ );
+};
+
+subtest 'aliases' => sub {
+ my $s = Sietima::Subscriber->new(
+ primary => 'Gino (pino) <gino@pino.example.com>',
+ aliases => [qw(also-gino@pino.example.com maybe-gino@rino.example.com)],
+ );
+
+ is(
+ $s,
+ object {
+ for my $a (qw(gino@pino also-gino@pino maybe-gino@rino)) {
+ call [match => "${a}.example.com"] => T();
+ }
+ },
+ 'all addresses should ->match()',
+ );
+
+};
+
+done_testing;