From f6eb0dfc05773870e57de4d99994d78c02c88263 Mon Sep 17 00:00:00 2001 From: swag Date: Thu, 8 Dec 2022 16:10:11 -0600 Subject: [PATCH] Moar tests --- README.md | 1 - t/moderator.t | 24 ++++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5dd1b05..72033a7 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ Run the tests locally (against development environment): ## TODOs -1. Tests for flagged view? Not much to it but got pulled into work stuff 1. View for hidden posts 1. Actions for creating moderators and resetting passwords 1. CSS diff --git a/t/moderator.t b/t/moderator.t index df2f483..d344d09 100644 --- a/t/moderator.t +++ b/t/moderator.t @@ -31,10 +31,6 @@ subtest Login => sub { ->status_is(302) ->header_like(Location => qr{moderator/flagged}); - $t->get_ok('/moderator/flagged') - ->status_is(200) - ->text_like(h2 => qr/Flagged Posts/); - $t->get_ok('/login') ->status_is(302) ->header_like(Location => qr{moderator/flagged}); @@ -80,6 +76,18 @@ subtest Login => sub { ->element_exists('a[href*="/unflag/1"]'); }; + subtest Flagged => sub { + $t->get_ok('/moderator/flagged') + ->status_is(200) + ->text_like(h2 => qr/Flagged Posts/) + }; + + #subtest Hidden => sub { + # $t->get_ok('/moderator/hidden') + # ->status_is(200) + # ->text_like(h2 => qr/Hidden Posts/) + #}; + # Mod session ends $t->get_ok('/logout') ->status_is(302) @@ -97,6 +105,14 @@ subtest Login => sub { ->element_exists_not('a[href*="/hide/1"]' ) ->element_exists_not('a[href*="/unhide/1"]') ->element_exists_not('a[href*="/unflag/1"]'); + + $t->get_ok('/moderator/flagged') + ->status_is(302) + ->header_like(Location => qr/login/); + + #$t->get_ok('/moderator/hidden') + # ->status_is(302) + # ->header_like(Location => qr/login/); }; };