2022-10-01 22:00:23 +00:00
|
|
|
use Mojo::Base -strict;
|
2022-08-20 03:28:16 +00:00
|
|
|
use Test::More;
|
|
|
|
use Test::Mojo;
|
|
|
|
|
2022-10-01 22:00:23 +00:00
|
|
|
my $t = Test::Mojo->new('PostText');
|
2022-08-20 03:28:16 +00:00
|
|
|
|
2022-10-06 02:46:15 +00:00
|
|
|
subtest 'List threads by page', sub {
|
2022-10-13 03:58:46 +00:00
|
|
|
$t->get_ok('/thread/list')->status_is(200)
|
|
|
|
->text_like(h2 => qr/Threads List/);
|
|
|
|
|
|
|
|
$t->get_ok('/thread/list/1')->status_is(200)
|
|
|
|
->text_like(h2 => qr/Threads List/);
|
2023-06-27 05:30:32 +00:00
|
|
|
|
|
|
|
$t->get_ok('/thread/list/65536')->status_is(404)
|
|
|
|
->text_like(p => qr/Page not found/);
|
2022-10-06 02:46:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
subtest 'View single thread', sub {
|
2022-10-13 03:58:46 +00:00
|
|
|
$t->get_ok('/thread/single/1')->status_is(200)
|
2023-06-28 00:55:41 +00:00
|
|
|
->text_like(h2 => qr/Thread #1/)
|
|
|
|
->element_exists('h2 sup a[href$=".txt"]');
|
2023-06-27 05:30:32 +00:00
|
|
|
$t->get_ok('/thread/single/65536')->status_is(404)
|
|
|
|
->text_like(p => qr/Thread not found/);
|
|
|
|
|
|
|
|
$t->get_ok('/thread/single/1.txt')->status_is(200)
|
|
|
|
->content_type_like(qr{text/plain});
|
|
|
|
$t->get_ok('/thread/single/65536.txt')->status_is(404)
|
|
|
|
->content_type_like(qr{text/plain});
|
2022-10-13 03:58:46 +00:00
|
|
|
|
2023-06-25 04:01:13 +00:00
|
|
|
# Test the thread_page and remark_id params
|
2022-10-13 03:58:46 +00:00
|
|
|
$t->get_ok('/thread/single/1/1')->status_is(200)
|
2023-06-25 04:01:13 +00:00
|
|
|
->element_exists('a[href$="/remark/post/1/1"]');
|
2023-05-14 20:17:10 +00:00
|
|
|
|
2023-06-27 05:30:32 +00:00
|
|
|
$t->get_ok('/thread/single/1/65536')->status_is(404)
|
|
|
|
->text_like(p => qr/Page not found/);
|
2022-10-06 02:46:15 +00:00
|
|
|
};
|
|
|
|
|
2023-04-24 18:25:32 +00:00
|
|
|
subtest 'Threads feed', sub {
|
|
|
|
$t->get_ok('/thread/feed.rss')->status_is(200)
|
|
|
|
->content_type_is('application/rss+xml')
|
|
|
|
};
|
|
|
|
|
2023-04-26 02:28:11 +00:00
|
|
|
done_testing;
|