diff --git a/README.md b/README.md index 580d92d..cdbe94c 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ Run the tests locally (against development environment) ## TODOs +1. Handle POST with no params (error) 1. Moar tests... 1. Pick a date format 1. **Moar tests!!** diff --git a/t/post.t b/t/post.t index 0060ccd..aee4a27 100644 --- a/t/post.t +++ b/t/post.t @@ -8,9 +8,20 @@ use Test::Mojo; my $script = curfile->dirname->sibling('PostText.pl'); my $t = Test::Mojo->new($script); +my %valid_params = ( + name => 'Anonymous', + title => 'hi', + body => 'ayy... lmao' + ); -$t->get_ok('/post')->status_is(200); +$t->ua->max_redirects(1); +$t->get_ok('/post')->status_is(200)->text_like(h2 => qr/New Thread/);; + +# This should fail!! 08142022 $t->post_ok('/post')->status_is(200); +$t->post_ok('/post', form => \%valid_params)->status_is(200) + ->text_like(h2 => qr/View Threads/); + done_testing(); diff --git a/t/view.t b/t/view.t index 0c7acb3..e4ebcc4 100644 --- a/t/view.t +++ b/t/view.t @@ -9,6 +9,6 @@ use Test::Mojo; my $script = curfile->dirname->sibling('PostText.pl'); my $t = Test::Mojo->new($script); -$t->get_ok('/view')->status_is(200); +$t->get_ok('/view')->status_is(200)->text_like(h2 => qr/View Threads/); done_testing();