App-Changelord/t/basic.t

59 lines
1.1 KiB
Perl
Raw Permalink Normal View History

2022-07-13 16:09:07 +00:00
use 5.36.0;
use Test2::V0;
use App::Changelord;
my $change = App::Changelord->new(
changelog => {
2022-07-13 19:00:23 +00:00
project => { name => 'Foo' },
2022-07-13 16:09:07 +00:00
}
);
like $change->as_markdown, qr/# Changelog for Foo/;
2022-07-13 18:26:08 +00:00
subtest 'homepage' => sub {
$change->changelog->{project}{homepage} = 'the-url';
my $header = $change->render_header;
like $header, qr/\[Foo\]\[homepage\]/;
like $header, qr/\Q [homepage]: the-url/;
};
2022-07-13 19:00:23 +00:00
subtest 'release' => sub {
is $change->render_release("yup, that's it"), "yup, that's it";
like $change->render_release({
version => 'v1.2.3',
date => '2022-01-02',
}) => qr/\Q## v1.2.3, 2022-01-02/;
};
subtest 'release changes' => sub {
is $change->render_release({
version => 'v1.2.3',
date => '2022-01-02',
changes => [
'foo',
{ type => 'feat', 'desc' => 'did the thing' },
{ type => 'fix', 'desc' => 'fixed the thing' },
]
}) => <<'END'
## v1.2.3, 2022-01-02
* foo
### Features
* did the thing
### Bug fixes
* fixed the thing
END
};
2022-07-13 16:09:07 +00:00
done_testing();