-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests work, but the 1 test in BlogPostTest is flaky. I tried explicitly setting the `publish` and `published_at` states for the 1 post I'm passing in to guarantee it'll be published, but it's not working... And it's literally just for this 1 test. In BlogIndexTest, it seems to be consistent...or is it?
- Loading branch information
Showing
3 changed files
with
44 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
<?php | ||
|
||
use Livewire\Volt\Volt; | ||
use function Pest\Laravel\get; | ||
|
||
voltMountable('blog-index'); | ||
|
||
it('renders posts that are published', function () { | ||
$posts = createPosts(10, true); | ||
|
||
Volt::test('blog-index') | ||
->assertOk() | ||
->assertSee($posts->get('title')) | ||
->assertSee($posts->get('excerpt')) | ||
->assertSee('Read More'); | ||
|
||
// for some reason this needs to be called after doing the actual volt test | ||
get('/blog') | ||
->assertOk() | ||
->assertSeeVolt('blog-index'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
<?php | ||
|
||
voltMountable('blog-post', static fn () => ['post' => createPost(true)]); | ||
use Livewire\Volt\Volt; | ||
|
||
it('can be mounted', function () { | ||
$post = createPost(true); | ||
|
||
expect($post->published) | ||
->toBeTrue('Testing "published" field') | ||
->and($post->published_at) | ||
->toBeInstanceOf(\Carbon\Carbon::class, 'Testing "published_at" field'); | ||
|
||
Volt::test('blog-post', compact('post'))->assertOk(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters