Skip to content

Commit c12621b

Browse files
committed
Updates post test.
1 parent 78980fa commit c12621b

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

stubs/modules/Blog/Tests/Site/PostTest.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,33 @@
88
uses(TestCase::class, RefreshDatabase::class);
99

1010
beforeEach(function () {
11-
$this->post = Post::factory()->create();
11+
$this->post = Post::factory()->create([
12+
'title' => 'Test Post',
13+
'content' => 'Test Content',
14+
'published_at' => now()->subDay(),
15+
]);
1216
});
1317

1418
afterEach(function () {
1519
if ($this->post->image) {
16-
Storage::disk('public')->delete('blog/'.$this->post->image);
20+
Storage::disk('public')->delete('blog/' . $this->post->image);
1721
}
1822
});
1923

2024
test('blog index page can be rendered', function () {
25+
$this->withoutVite();
2126
$response = $this->get('/blog');
2227

2328
$response->assertStatus(200);
29+
$response->assertSee('Blog');
30+
$response->assertSee($this->post->title);
31+
});
32+
33+
test('blog post page can be rendered', function () {
34+
$this->withoutVite();
35+
$response = $this->get('/blog/' . $this->post->slug);
36+
37+
$response->assertStatus(200);
38+
$response->assertSee($this->post->title);
39+
$response->assertSee($this->post->content);
2440
});

0 commit comments

Comments
 (0)