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.
$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
Thanks! I'll try!