about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-05-23 21:36:50 +0000
committerEric Wong <e@80x24.org>2021-05-24 22:31:36 +0000
commita9bfba8eb31dbb4cdb8306496a911a84f8ac6e04 (patch)
treec897e38b6de8c5e2673401bc66a2bd8088b895fe /t
parent2d4ac1c886908bb1d79592913a2a2037a1a024e7 (diff)
downloadpublic-inbox-a9bfba8eb31dbb4cdb8306496a911a84f8ac6e04.tar.gz
lei inspect: use LeiMailSync->match_imap_url
Move match_imap_url into LeiMailSync so it can be used in more
places, such as "lei inspect".  Upcoming commands such as
"lei forget-mail-sync" and {add,forget,pause,resume}-watch will
also support relaxed IMAP matching rules since there's
no reasonable way to expect users use ";UIDVALIDITY=" on the
command-line.
Diffstat (limited to 't')
-rw-r--r--t/lei-import-imap.t10
1 files changed, 8 insertions, 2 deletions
diff --git a/t/lei-import-imap.t b/t/lei-import-imap.t
index d424ebb1..d3935c82 100644
--- a/t/lei-import-imap.t
+++ b/t/lei-import-imap.t
@@ -22,9 +22,15 @@ test_lei({ tmpdir => $tmpdir }, sub {
         is_deeply(json_utf8->decode($lei_out), {}, 'no inspect stats, yet');
 
         lei_ok('import', $url);
+        lei_ok('inspect', $url);
+        my $res = json_utf8->decode($lei_out);
+        is(scalar keys %$res, 1, 'got one key in inspect URL');
+        my $re = qr!\Aimap://;AUTH=ANONYMOUS\@\Q$host_port\E
+                        /t\.v2\.0;UIDVALIDITY=\d+!x;
+        like((keys %$res)[0], qr/$re\z/, 'got expanded key');
+
         lei_ok 'ls-mail-sync';
-        like($lei_out, qr!\Aimap://;AUTH=ANONYMOUS\@\Q$host_port\E
-                        /t\.v2\.0;UIDVALIDITY=\d+\n\z!x, 'ls-mail-sync');
+        like($lei_out, qr!$re\n\z!, 'ls-mail-sync');
         chomp(my $u = $lei_out);
         lei_ok('import', $u, \'UIDVALIDITY match in URL');
         $url = $u;