22 lines
464 B
Perl
22 lines
464 B
Perl
use Mojo::Base -strict;
|
|
|
|
use Test2::V0;
|
|
use Test::Mojo;
|
|
|
|
my $t = Test::Mojo->new('MyApp');
|
|
|
|
# Page zero gets a redirect.
|
|
$t->get_ok('/books/0')->status_is(302);
|
|
|
|
# Now follow redirects and verify it's a 404.
|
|
$t->ua->max_redirects(10);
|
|
$t->get_ok('/books/0')->status_is(404);
|
|
|
|
# Likewise for a too-high page number.
|
|
$t->get_ok('/books/999?title_like=qxqxqxqx')->status_is(404);
|
|
|
|
# Or non-existent author.
|
|
$t->get_ok('/author/0/1')->status_is(404);
|
|
|
|
done_testing();
|