From bb48817534fc770bd1bd57b3c977d1afa6dc8c91 Mon Sep 17 00:00:00 2001 From: swaggboi Date: Fri, 19 Aug 2022 23:28:16 -0400 Subject: [PATCH] Clean up the single thread view a bit and put a test in place --- README.md | 2 -- t/thread.t | 14 ++++++++++++++ templates/thread_id.html.ep | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 t/thread.t diff --git a/README.md b/README.md index a4289f3..069dce7 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,6 @@ Run the tests locally (against development environment) ## TODOs -1. Clean up that single thread view (it's late and I need sleep) -1. Tests for single thread view 1. Retrieve replies in the single thread view 1. Paging for replies in single thread view 1. Default 'threads per page' is broken if config file isn't correct diff --git a/t/thread.t b/t/thread.t new file mode 100644 index 0000000..0f17837 --- /dev/null +++ b/t/thread.t @@ -0,0 +1,14 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use Test::More; +use Mojo::File qw{curfile}; +use Test::Mojo; + +my $script = curfile->dirname->sibling('PostText.pl'); +my $t = Test::Mojo->new($script); + +$t->get_ok('/thread/1')->status_is(200)->text_like(h2 => qr/View Thread - #1/); + +done_testing(); diff --git a/templates/thread_id.html.ep b/templates/thread_id.html.ep index be4fcad..a935430 100644 --- a/templates/thread_id.html.ep +++ b/templates/thread_id.html.ep @@ -1,5 +1,5 @@ % layout 'main'; -% title 'View Threads'; +% title "View Thread - #$thread->{'id'}";

<%= title %>

<% if (my $thread = $thread) { %>