withPersonalOrganization()->create(); $this->actingAs($user); // Act $response = $this->get('/dashboard'); // Assert $response->assertSuccessful(); $response->assertInertia(fn (Assert $page) => $page ->has('weeklyProjectOverview') ->has('latestTasks') ->has('lastSevenDays') ->has('latestTeamActivity') ->has('dailyTrackedHours') ->has('totalWeeklyTime') ->has('totalWeeklyBillableTime') ->has('totalWeeklyBillableAmount') ->has('weeklyHistory') ->whereNot('weeklyProjectOverview', null) ->whereNot('latestTasks', null) ->whereNot('lastSevenDays', null) ->whereNot('latestTeamActivity', null) ->whereNot('dailyTrackedHours', null) ->whereNot('totalWeeklyTime', null) ->whereNot('totalWeeklyBillableTime', null) ->whereNot('totalWeeklyBillableAmount', null) ->whereNot('weeklyHistory', null) ->whereNot('latestTeamActivity', null) ); } public function test_showing_dashboard_succeeds_with_less_data_for_user_with_employee_role(): void { // Arrange $organization = Organization::factory()->create(); $user = User::factory()->forCurrentOrganization($organization)->create(); $organization->users()->attach($user, ['role' => Role::Employee->value]); $this->actingAs($user); // Act $response = $this->get('/dashboard'); // Assert $response->assertSuccessful(); $response->assertInertia(fn (Assert $page) => $page ->has('weeklyProjectOverview') ->has('latestTasks') ->has('lastSevenDays') ->has('latestTeamActivity') ->has('dailyTrackedHours') ->has('totalWeeklyTime') ->has('totalWeeklyBillableTime') ->has('totalWeeklyBillableAmount') ->has('weeklyHistory') ->whereNot('weeklyProjectOverview', null) ->whereNot('latestTasks', null) ->whereNot('lastSevenDays', null) ->where('latestTeamActivity', null) ->whereNot('dailyTrackedHours', null) ->whereNot('totalWeeklyTime', null) ->whereNot('totalWeeklyBillableTime', null) ->whereNot('totalWeeklyBillableAmount', null) ->whereNot('weeklyHistory', null) ); } }