generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from dissto/add-tests-for-default-delete-actions
Add tests for the default delete actions (bulk and regular)
- Loading branch information
Showing
6 changed files
with
72 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
it('can bulk delete records', function () { | ||
$records = $MODEL_SINGULAR_NAME$::factory()->count(3)->create(); | ||
|
||
livewire(List$MODEL_PLURAL_NAME$::class) | ||
->callTableBulkAction(DeleteBulkAction::class, $records); | ||
|
||
foreach ($records as $record) { | ||
$this->assertModelMissing($record); | ||
} | ||
|
||
expect($MODEL_SINGULAR_NAME$::find($records->pluck('id')))->toBeEmpty(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
it('can bulk soft delete records', function () { | ||
$records = $MODEL_SINGULAR_NAME$::factory()->count(3)->create(); | ||
|
||
livewire(List$MODEL_PLURAL_NAME$::class) | ||
->callTableBulkAction(DeleteBulkAction::class, $records); | ||
|
||
foreach ($records as $record) { | ||
$this->assertSoftDeleted($record); | ||
} | ||
|
||
expect($MODEL_SINGULAR_NAME$::find($records->pluck('id')))->toBeEmpty(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
it('can delete records', function () { | ||
$record = $MODEL_SINGULAR_NAME$::factory()->create(); | ||
|
||
livewire(List$MODEL_PLURAL_NAME$::class) | ||
->callTableAction(DeleteAction::class, $record); | ||
|
||
$this->assertModelMissing($record); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
it('can soft delete records', function () { | ||
$record = $MODEL_SINGULAR_NAME$::factory()->create(); | ||
|
||
livewire(List$MODEL_PLURAL_NAME$::class) | ||
->callTableAction(DeleteAction::class, $record); | ||
|
||
$this->assertSoftDeleted($record); | ||
}); |