Moved invitation from jetstream to API; Deactived moved jetstream features

This commit is contained in:
Constantin Graf
2024-07-15 17:17:56 +02:00
committed by Constantin Graf
parent 555417dbbd
commit fd8d596e9b
25 changed files with 294 additions and 348 deletions

View File

@@ -13,7 +13,7 @@ class UpdateTeamMemberRoleTest extends TestCase
{
use RefreshDatabase;
public function test_team_member_roles_can_be_updated(): void
public function test_team_member_roles_can_no_longer_be_updated_over_jetstream(): void
{
// Arrange
$user = User::factory()->withPersonalOrganization()->create();
@@ -28,73 +28,8 @@ class UpdateTeamMemberRoleTest extends TestCase
'role' => Role::Employee->value,
]);
// Assert
$this->assertTrue($otherUser->fresh()->hasTeamRole(
$user->currentTeam->fresh(), Role::Employee->value,
));
}
public function test_team_member_roles_can_not_be_updated_to_placeholder(): void
{
// Arrange
$user = User::factory()->withPersonalOrganization()->create();
$this->actingAs($user);
$user->currentTeam->users()->attach(
$otherUser = User::factory()->create(), ['role' => 'admin']
);
// Act
$response = $this->put('/teams/'.$user->currentTeam->id.'/members/'.$otherUser->id, [
'role' => 'placeholder',
]);
// Assert
$this->assertTrue($otherUser->fresh()->hasTeamRole(
$user->currentTeam->fresh(), 'admin'
));
}
public function test_team_member_roles_can_be_updated_to_owner_which_changes_ownership(): void
{
// Arrange
$user = User::factory()->withPersonalOrganization()->create();
$this->actingAs($user);
$otherUser = User::factory()->create();
$user->currentTeam->users()->attach($otherUser, ['role' => 'admin']);
// Act
$response = $this->withoutExceptionHandling()->put('/teams/'.$user->currentTeam->id.'/members/'.$otherUser->getKey(), [
'role' => Role::Owner->value,
]);
// Assert
$this->assertTrue($otherUser->fresh()->hasTeamRole(
$user->currentTeam->fresh(), Role::Owner->value
));
$this->assertSame($user->currentTeam->fresh()->user_id, $otherUser->getKey());
}
public function test_only_team_owner_can_update_team_member_roles(): void
{
// Arrange
$user = User::factory()->withPersonalOrganization()->create();
$user->currentTeam->users()->attach(
$otherUser = User::factory()->create(), ['role' => 'admin']
);
$this->actingAs($otherUser);
// Act
$response = $this->put('/teams/'.$user->currentTeam->id.'/members/'.$otherUser->id, [
'role' => Role::Employee->value,
]);
// Assert
$response->assertStatus(403);
$this->assertTrue($otherUser->fresh()->hasTeamRole(
$user->currentTeam->fresh(), 'admin'
));
$response->assertSee('Moved to API');
}
}