How test resource flag --simple

I have a resource EquipmentOwnersResource that was created using the command sail artisan make:filament-resource EquipmentOwner --simple. This generates a single page for the resource instead of the typical 3 and puts the create/edit form in a modal instead of loading a new page. I've create a Pest test as follows: it('can create equipment owners', function () {
$equipmentOwner = EquipmentOwner::factory()->make();
livewire(ManageEquipmentOwners::class) ->set('name', $equipmentOwner->name) ->call('save') ->assertHasNoFormErrors(); }); However, when running the test I get an error "Unable to call component method. Public method [save] not found on component." I know this is because I'm not using the standard create/edit pages, but the Filament docs don't have an example of testing these "simple" resources.
2 Replies
LeandroFerreira
LeandroFerreira2mo ago
try this
livewire(ManageEquipmentOwners::class)
->callAction('create', data: [
'name' => $equipmentOwner->name
])
->assertHasNoActionErrors();
livewire(ManageEquipmentOwners::class)
->callAction('create', data: [
'name' => $equipmentOwner->name
])
->assertHasNoActionErrors();
https://filamentphp.com/docs/3.x/actions/testing#getting-started
Leonardy
Leonardy2mo ago
Thanks! I'll try!
Want results from more Discord servers?
Add your server