I’m trying to test validations on CreateTeamForm component of Jetstream but assertHasErrors doesn’t catch the error (even if the component is catching it correctly) and always return a “Component has no errors.” message.
It seems that it loose the error bag on the way (maybe on the toSubsequentResponse method of Response class but i’m not sure)
Here is the test, you can launch it on a laravel jetstream installation.
public function name_is_required()
{
$this->actingAs(User::factory()->create());
Livewire::test(CreateTeamForm::class)
->set('state.name', '')
->call('createTeam')
->assertHasErrors(['name' => 'required']);
}
I’m using livewire 2.2.5 on laravel 8.5
Any tips?