Add the tests; blank favicon
This commit is contained in:
parent
464ae72894
commit
fc0875ca0f
@ -5,5 +5,4 @@ Sequel to the smash hit
|
||||
|
||||
## TODOs
|
||||
|
||||
- Tests
|
||||
- Fill in placeholder comments
|
||||
|
1
hr2.pl
Normal file → Executable file
1
hr2.pl
Normal file → Executable file
@ -3,6 +3,7 @@
|
||||
# May 2025
|
||||
# Jia Tan <JiaT75@gmail.com>
|
||||
|
||||
use v5.40;
|
||||
use Mojolicious::Lite -signatures;
|
||||
use Mojo::Util qw{b64_decode b64_encode
|
||||
gunzip gzip
|
||||
|
0
public/favicon.ico
Normal file
0
public/favicon.ico
Normal file
23
t/create.t
Normal file
23
t/create.t
Normal file
@ -0,0 +1,23 @@
|
||||
use Test::More;
|
||||
use Mojo::File qw{curfile};
|
||||
use Test::Mojo;
|
||||
|
||||
my $script = curfile->dirname->sibling('hr2.pl');
|
||||
my $t = Test::Mojo->new($script);
|
||||
my $example = 'H4sIAKeZJ2gAA8soKSmw0tdPrUjMLchJ1UvOzwUArN4B1xIAAAA%3D%0A';
|
||||
my %hl_form = (hyperlink => 'http://example.com');
|
||||
my %mr_form = (
|
||||
'hyperlink', $hl_form{'hyperlink'},
|
||||
'meta-refresh', 1
|
||||
);
|
||||
|
||||
$t->get_ok('/create')->status_is(200)
|
||||
->text_like(h1 => qr/Create new hyperlink/);
|
||||
|
||||
$t->post_ok('/create', form => \%hl_form)->status_is(200)
|
||||
->attr_like(a => href => qr/$example/);
|
||||
|
||||
$t->post_ok('/create', form => \%hl_form)->status_is(200)
|
||||
->attr_like(a => href => qr/--meta-refresh\/$example/);
|
||||
|
||||
done_testing;
|
10
t/favicon.t
Normal file
10
t/favicon.t
Normal file
@ -0,0 +1,10 @@
|
||||
use Test::More;
|
||||
use Mojo::File qw{curfile};
|
||||
use Test::Mojo;
|
||||
|
||||
my $script = curfile->dirname->sibling('hr2.pl');
|
||||
my $t = Test::Mojo->new($script);
|
||||
|
||||
$t->get_ok('/favicon.ico')->status_is(200);
|
||||
|
||||
done_testing;
|
15
t/hyperlink.t
Normal file
15
t/hyperlink.t
Normal file
@ -0,0 +1,15 @@
|
||||
use Test::More;
|
||||
use Mojo::File qw{curfile};
|
||||
use Test::Mojo;
|
||||
|
||||
my $script = curfile->dirname->sibling('hr2.pl');
|
||||
my $t = Test::Mojo->new($script);
|
||||
my $example = 'H4sIAKeZJ2gAA8soKSmw0tdPrUjMLchJ1UvOzwUArN4B1xIAAAA%3D%0A';
|
||||
|
||||
$t->get_ok("/$example")->status_is(302)
|
||||
->header_is(Location => 'http://example.com');
|
||||
|
||||
$t->get_ok("/--meta-refresh/$example")->status_is(200)
|
||||
->attr_like(meta => content => qr/http:\/\/example\.com/);
|
||||
|
||||
done_testing;
|
Loading…
x
Reference in New Issue
Block a user