Skip to content

Commit

Permalink
indexer: add tests for "nothing to index" email
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Jun 22, 2024
1 parent fac7463 commit a6e19d1
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions t/mldistwatch-misc.t
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,52 @@ subtest "the notorious version zero" => sub {
}
};

subtest "indexer ran, but nothing indexed" => sub {
# This is to test the weird _update_mail_content_when_nothing_was_indexed
# case in PAUSE::dist.
my $pause = PAUSE::TestPAUSE->init_new;

{
# If we want to upload an Empty-Dist-2.0 with no packages, we need the
# uploader to have permissions on Empty::Dist, so we will first upload
# Empty-Dist-1.0 with the expected package.
$pause->upload_author_fake(CBROWN => 'Empty-Dist-1.0.tar.gz');

my $result = $pause->test_reindex;
}

my $file = $pause->upload_author_fake(CBROWN => {
name => 'Empty-Dist',
version => '2.0',
meta_munger => sub {
my ($meta) = @_;
$meta->{provides} = {};
return $meta;
}
});

my $result = $pause->test_reindex;

# Nothing in this distro has been indexed, because according to META.yml
# this package does not provide any modules.
$result->email_ok(
[
{
subject => 'Failed: PAUSE indexer report CBROWN/Empty-Dist-2.0.tar.gz',
callbacks => [
sub {
like(
$_[0]{email}->object->body_str,
qr/this package does not provide any modules/,
"email has the expected content",
);
},
],
},
],
);
};

done_testing;

# Local Variables:
Expand Down

0 comments on commit a6e19d1

Please sign in to comment.