Added test

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-06-22 18:36:08 +01:00
parent 06737f45ad
commit 61f76dedc6

View file

@ -25,7 +25,7 @@ class DeleteUserTest extends TestCase
public function testErrorReturnedViaApiIfUserDoesNotExist()
{
$this->actingAsForApi(User::factory()->deleteUsers()->create(['company_id'=> null]))
$this->actingAsForApi(User::factory()->deleteUsers()->create())
->deleteJson(route('api.users.destroy', 'invalid-id'))
->assertOk()
->assertStatus(200)
@ -33,6 +33,17 @@ class DeleteUserTest extends TestCase
->json();
}
public function testErrorReturnedViaApiIfUserIsAlreadyDeleted()
{
$user = User::factory()->deletedUser()->create();
$this->actingAsForApi(User::factory()->deleteUsers()->create())
->deleteJson(route('api.users.destroy', $user->id))
->assertOk()
->assertStatus(200)
->assertStatusMessageIs('error')
->json();
}
public function testDisallowUserDeletionViaApiIfStillManagingPeople()
{