From a9bfba8eb31dbb4cdb8306496a911a84f8ac6e04 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 23 May 2021 21:36:50 +0000 Subject: 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. --- t/lei-import-imap.t | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 't') 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; -- cgit v1.2.3-24-ge0c7