summaryrefslogtreecommitdiff
path: root/t/store.t
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2019-12-28 14:23:48 +0000
committerdakkar <dakkar@thenautilus.net>2019-12-28 14:23:48 +0000
commit906180e94bcc5dc09c146c1041df0f135e11b89b (patch)
treeace8cc12b9d0bdc9518eac14030dd34537ab8f3a /t/store.t
parentmake things faster by doing more work (?!??!) (diff)
downloadMaildirIndexer-906180e94bcc5dc09c146c1041df0f135e11b89b.tar.gz
MaildirIndexer-906180e94bcc5dc09c146c1041df0f135e11b89b.tar.bz2
MaildirIndexer-906180e94bcc5dc09c146c1041df0f135e11b89b.zip
test for Store
Diffstat (limited to 't/store.t')
-rw-r--r--t/store.t33
1 files changed, 33 insertions, 0 deletions
diff --git a/t/store.t b/t/store.t
new file mode 100644
index 0000000..73903df
--- /dev/null
+++ b/t/store.t
@@ -0,0 +1,33 @@
+#!perl6
+use v6.d;
+use Test;
+use lib 't/lib';
+use TestIndex;
+use MaildirIndexer::Store;
+use MaildirIndexer::Index;
+
+my Channel $file-channel .= new;
+my TestIndex $index .= new;
+my MaildirIndexer::Store $store .= new: :$file-channel, :indices($index), :2workers;
+
+$store.start();
+
+$index.set-expect(4);
+$file-channel.send("t/fixtures/$_".IO) for qw[one/cur/1 one/cur/2 two/cur/1 two/cur/2];
+await $index.seen-all;
+
+is-deeply(
+ $index.mails,
+ %(
+ one => %( 't/fixtures/one/cur/1' => 1, 't/fixtures/one/cur/2' => 1 ),
+ two => %( 't/fixtures/two/cur/1' => 1, 't/fixtures/two/cur/2' => 1 ),
+ ),
+ 'mails should be indexed',
+);
+
+is(
+ $store.mailbox-for-email(MaildirIndexer::Email.new),'foo',
+ 'index is consulted',
+);
+
+done-testing;