Similar to this question: How do you test response contains string in Inertia unit tests?
How can I test if a string exists when using Laravel 9, Vue 3, and inertia?
My code:
public function test_footer_is_loading()
{
$user = User::factory()->create();
$this
->actingAs($user)
->get(route('home'))
->assertInertia(fn (Assert $assert) => $assert
->has('all rights reserved')
);
// $response->assertSee('all rights reserved');
}
I think has
looks for a property or variable?
CodePudding user response:
Yes, seems that has
expects a key and a value (check out the example at the bottom of the page - https://inertiajs.com/testing).
...
->has('myKey', 'this value')
...
CodePudding user response:
I guess the answer is NO you can't check if there's a string. But this page is all you need to know everything about testing with Ineria: https://github.com/claudiodekker/inertia-laravel-testing/blob/8c8191b2b910ebdd4979911c9fbae60a188a85b4/README.md It's a package that is merged to Inertia now