New TODO and some tests for Flagging

This commit is contained in:
swag 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();