Renamed jetstream team to organization

This commit is contained in:
Constantin Graf
2024-01-21 19:52:19 +01:00
parent 6377df1f44
commit 0a8d958ccc
63 changed files with 461 additions and 329 deletions

View File

@@ -7,7 +7,6 @@ namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Mail;
use Laravel\Jetstream\Features;
use Laravel\Jetstream\Mail\TeamInvitation;
use Tests\TestCase;
@@ -17,41 +16,37 @@ class InviteTeamMemberTest extends TestCase
public function test_team_members_can_be_invited_to_team(): void
{
if (! Features::sendsTeamInvitations()) {
$this->markTestSkipped('Team invitations not enabled.');
}
// Arrange
Mail::fake();
$this->actingAs($user = User::factory()->withPersonalOrganization()->create());
$this->actingAs($user = User::factory()->withPersonalTeam()->create());
// Act
$response = $this->post('/teams/'.$user->currentTeam->id.'/members', [
'email' => 'test@example.com',
'role' => 'admin',
]);
// Assert
Mail::assertSent(TeamInvitation::class);
$this->assertCount(1, $user->currentTeam->fresh()->teamInvitations);
}
public function test_team_member_invitations_can_be_cancelled(): void
{
if (! Features::sendsTeamInvitations()) {
$this->markTestSkipped('Team invitations not enabled.');
}
// Arrange
Mail::fake();
$this->actingAs($user = User::factory()->withPersonalTeam()->create());
$this->actingAs($user = User::factory()->withPersonalOrganization()->create());
$invitation = $user->currentTeam->teamInvitations()->create([
'email' => 'test@example.com',
'role' => 'admin',
]);
// Act
$response = $this->delete('/team-invitations/'.$invitation->id);
// Assert
$this->assertCount(0, $user->currentTeam->fresh()->teamInvitations);
}
}