Skip to content

Commit

Permalink
Add assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusmoore committed Sep 16, 2024
1 parent 38b9f4a commit 2f76c1b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/Feature/Departments/Api/DeleteDepartmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ public function testCanDeleteDepartment()
$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();
Expand Down

0 comments on commit 2f76c1b

Please sign in to comment.