mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-12 18:22:16 +01:00
Hide latestTeamActivity for members with employee role
This commit is contained in:
@@ -4,7 +4,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Endpoint\Web;
|
||||
|
||||
use App\Enums\Role;
|
||||
use App\Models\Organization;
|
||||
use App\Models\User;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
|
||||
class DashboardEndpointTest extends EndpointTestAbstract
|
||||
{
|
||||
@@ -19,5 +22,61 @@ class DashboardEndpointTest extends EndpointTestAbstract
|
||||
|
||||
// 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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user