New TODO and some tests for Flagging

This commit is contained in:
swagg boi 2022-10-12 22:14:28 -04:00
parent 5153da02f9
commit 787cfc9bb1
5 changed files with 23 additions and 6 deletions

View file

@ -32,6 +32,7 @@ Run the tests locally (against development environment):
## TODOs
1. Consolidate routes
1. Implement flag post button
1. Implement
[bcrypt](https://metacpan.org/pod/Mojolicious::Plugin::BcryptSecure)

View file

@ -78,6 +78,11 @@ sub startup($self) {
->to('thread#by_id')
->name('single_thread');
my $bump_thread = $r->under('/bump');
$bump_thread->get('/:thread_id', [thread_id => qr/[0-9]+/])
->to('thread#bump')
->name('bump_thread');
# Remark
my $post_remark = $r->under('/post');
$post_remark
@ -89,12 +94,6 @@ sub startup($self) {
$single_remark->get('/:remark_id', [remark_id => qr/[0-9]+/])
->to('remark#by_id')
->name('single_remark');
# Bump
my $bump_thread = $r->under('/bump');
$bump_thread->get('/:thread_id', [thread_id => qr/[0-9]+/])
->to('thread#bump')
->name('bump_thread');
}
1;

1
t/.#remark.t Symbolic link
View file

@ -0,0 +1 @@
daniel@graymember.98268

View file

@ -17,6 +17,12 @@ subtest 'View single remark', sub {
$t->get_ok('/remark/1')->status_is(200)->text_like(h2 => qr/Remark #1/);
};
subtest 'Flagging remark', sub {
$t->get_ok('/remark/1')->status_is(200)
->element_exists('a[href*="flag"]')
->text_like(h2 => qr/Thread #1/);
}
$t->ua->max_redirects(1);
subtest 'Post new remark', sub {

View file

@ -67,4 +67,14 @@ subtest 'Bumping thread', sub {
->text_like(p => qr/Thread #[0-9]+ has been bumped/);
};
subtest 'Flagging thread', sub {
$t->get_ok('/list')->status_is(200)
->element_exists('a[href*="flag"]')
->text_like(h2 => qr/Threads List/);
$t->get_ok('/thread/1')->status_is(200)
->element_exists('a[href*="flag"]')
->text_like(h2 => qr/Thread #1/);
}
done_testing();