Skip to content

Commit

Permalink
Add tests for the fluent date-author string
Browse files Browse the repository at this point in the history
See #240
  • Loading branch information
caendesilva committed May 11, 2022
1 parent 20da65e commit 30f7f67
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/Unit/Views/ArticleExcerptViewTest.php
Expand Up @@ -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</span>', $view);
$this->assertStringNotContainsString('Jan 1st, 2022</span>,', $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</span>,', $view);
}
}

0 comments on commit 30f7f67

Please sign in to comment.