Restore action test not working

I am writing tests for relation manager's soft delete functionality. The RestoreAction is somehow not working. it('can restore contact', function () { $admin = Admin::factory() ->has(Contact::factory()->count(1)) ->create(); $contact = $admin->contacts->first(); livewire(ContactsRelationManager::class, [ 'ownerRecord' => $admin, 'pageClass' => EditAdmin::class, ]) ->mountTableAction(DeleteAction::class, $contact) ->callMountedTableAction(); livewire(ContactsRelationManager::class, [ 'ownerRecord' => $admin, 'pageClass' => EditAdmin::class, ]) ->mountTableAction(RestoreAction::class, $contact) ->callMountedTableAction(); $this->assertDatabaseHas(Contact::class, [ 'id' => $contact->id, 'deleted_at' => null, ]); });
Solution:
Fixed just need to add ->filterTable('trashed') when we are restoring.
Jump to solution
1 Reply
Solution
Akshay Bokade
Akshay Bokade13mo ago
Fixed just need to add ->filterTable('trashed') when we are restoring.
Want results from more Discord servers?
Add your server