diff --git a/tests/Unit/Views/ArticleExcerptViewTest.php b/tests/Unit/Views/ArticleExcerptViewTest.php index c3a7bed4..f71c653b 100644 --- a/tests/Unit/Views/ArticleExcerptViewTest.php +++ b/tests/Unit/Views/ArticleExcerptViewTest.php @@ -52,4 +52,24 @@ public function test_component_renders_post_with_author_object() $this->assertStringContainsString('John Doe', $view); } + + public function test_there_is_no_comma_after_date_string_when_there_is_no_author() + { + $view = $this->renderTestView(new MarkdownPost([ + 'date' => '2022-01-01', + ], '')); + + $this->assertStringContainsString('Jan 1st, 2022', $view); + $this->assertStringNotContainsString('Jan 1st, 2022,', $view); + } + + public function test_there_is_a_comma_after_date_string_when_there_is_a_author() + { + $view = $this->renderTestView(new MarkdownPost([ + 'date' => '2022-01-01', + 'author' => 'John Doe', + ], '')); + + $this->assertStringContainsString('Jan 1st, 2022,', $view); + } }