+
+ lei_ok('inspect', $url);
+ 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!$re\n\z!, 'ls-mail-sync');
+ chomp(my $u = $lei_out);
+ lei_ok('import', $u, \'UIDVALIDITY match in URL');
+ $url = $u;
+ $u =~ s/;UIDVALIDITY=(\d+)\s*/;UIDVALIDITY=9$1/s;
+ ok(!lei('import', $u), 'UIDVALIDITY mismatch in URL rejected');
+ like($lei_err, qr/UIDVALIDITY mismatch/, 'mismatch noted');
+
+ lei_ok('inspect', $url);
+ my $inspect = json_utf8->decode($lei_out);
+ my @k = keys %$inspect;
+ is(scalar(@k), 1, 'one URL resolved');
+ is($k[0], $url, 'inspect URL matches');
+ my $stats = $inspect->{$k[0]};
+ is_deeply([ sort keys %$stats ],
+ [ qw(uid.count uid.max uid.min) ], 'keys match');
+ ok($stats->{'uid.min'} < $stats->{'uid.max'}, 'min < max');
+ ok($stats->{'uid.count'} > 0, 'count > 0');
+
+ lei_ok('lcat', $url);
+ is(scalar(grep(/^# blob:/, split(/\n/ms, $lei_out))),
+ $stats->{'uid.count'}, 'lcat on URL dumps folder');
+ lei_ok qw(lcat -f json), $url;
+ $out = json_utf8->decode($lei_out);
+ is(scalar(@$out) - 1, $stats->{'uid.count'}, 'lcat JSON dumps folder');
+