Moar tests

This commit is contained in:
swaggboi 2022-08-14 00:30:26 -04:00
parent 5273bba35c
commit 0d492467a4
3 changed files with 14 additions and 2 deletions

View File

@ -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!!**

View File

@ -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();

View File

@ -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();