]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/lei-import-nntp.t
fetch|clone|--mirror: shorten paths for progress output
[public-inbox.git] / t / lei-import-nntp.t
index d795a86a8486e190f54cb456fe87c72b180bbc61..f2c3540624290f6e0dc170325448bd2b4a502d7d 100644 (file)
@@ -16,10 +16,16 @@ test_lei({ tmpdir => $tmpdir }, sub {
        lei_ok(qw(q z:1..));
        my $out = json_utf8->decode($lei_out);
        is_deeply($out, [ undef ], 'nothing imported, yet');
-       lei_ok('import', "nntp://$host_port/t.v2");
-       diag $lei_err;
+       my $url = "nntp://$host_port/t.v2";
+       lei_ok(qw(ls-mail-source), "nntp://$host_port/");
+       like($lei_out, qr/^t\.v2$/ms, 'shows newsgroup');
+       lei_ok(qw(ls-mail-source), $url);
+       is($lei_out, "t.v2\n", 'shows only newsgroup with filter');
+       lei_ok(qw(ls-mail-source -l), "nntp://$host_port/");
+       is(ref(json_utf8->decode($lei_out)), 'ARRAY', 'ls-mail-source JSON');
+
+       lei_ok('import', $url);
        lei_ok(qw(q z:1..));
-       diag $lei_err;
        $out = json_utf8->decode($lei_out);
        ok(scalar(@$out) > 1, 'got imported messages');
        is(pop @$out, undef, 'trailing JSON null element was null');
@@ -27,7 +33,9 @@ test_lei({ tmpdir => $tmpdir }, sub {
        for (@$out) { $r{ref($_)}++ }
        is_deeply(\%r, { 'HASH' => scalar(@$out) }, 'all hashes');
 
-       my $f = "$ENV{HOME}/.local/share/lei/store/net_last.sqlite3";
-       ok(-s $f, 'net tracked for redundant imports');
+       my $f = "$ENV{HOME}/.local/share/lei/store/mail_sync.sqlite3";
+       ok(-s $f, 'mail_sync exists tracked for redundant imports');
+       lei_ok 'ls-mail-sync';
+       like($lei_out, qr!\A\Q$url\E\n\z!, 'ls-mail-sync output as-expected');
 });
 done_testing;