Add assertion

This commit is contained in:
Marcus Moore 2024-09-16 10:33:21 -07:00
parent 38b9f4a438
commit 2f76c1bc5b
No known key found for this signature in database

View file

@ -32,6 +32,17 @@ class DeleteDepartmentTest extends TestCase implements TestsMultipleFullCompanyS
$this->assertDatabaseMissing('departments', ['id' => $department->id]);
}
public function testCannotDeleteDepartmentThatStillHasUsers()
{
$department = Department::factory()->hasUsers()->create();
$this->actingAsForApi(User::factory()->deleteDepartments()->create())
->deleteJson(route('api.departments.destroy', $department))
->assertStatusMessageIs('error');
$this->assertNotNull($department->fresh(), 'Department unexpectedly deleted');
}
public function testAdheresToMultipleFullCompanySupportScoping()
{
[$companyA, $companyB] = Company::factory()->count(2)->create();