Added API test, renamed test to match filter

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2025-02-23 13:21:36 +00:00
parent 7b151cf692
commit 157801242d

View file

@ -9,7 +9,7 @@ use Tests\Concerns\TestsFullMultipleCompaniesSupport;
use Tests\Concerns\TestsPermissionsRequirement; use Tests\Concerns\TestsPermissionsRequirement;
use Tests\TestCase; use Tests\TestCase;
class DeleteComponentsTest extends TestCase implements TestsFullMultipleCompaniesSupport, TestsPermissionsRequirement class DeleteComponentTest extends TestCase implements TestsFullMultipleCompaniesSupport, TestsPermissionsRequirement
{ {
public function testRequiresPermission() public function testRequiresPermission()
{ {
@ -63,4 +63,13 @@ class DeleteComponentsTest extends TestCase implements TestsFullMultipleCompanie
$this->assertSoftDeleted($component); $this->assertSoftDeleted($component);
} }
public function testCannotDeleteComponentIfCheckedOut()
{
$component = Component::factory()->checkedOutToAsset()->create();
$this->actingAsForApi(User::factory()->deleteComponents()->create())
->deleteJson(route('api.components.destroy', $component))
->assertStatusMessageIs('error');
}
} }