mirror of
https://github.com/tiennm99/coolify.git
synced 2026-05-03 16:21:11 +00:00
refactor(ui): improve styling and consistency in environment variable warning and docker cleanup components
This commit is contained in:
@@ -1,63 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Team;
|
||||
use App\Models\TeamInvitation;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class TeamInvitationEmailNormalizationTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
public function test_team_invitation_normalizes_email_to_lowercase()
|
||||
{
|
||||
// Create a team
|
||||
$team = Team::factory()->create();
|
||||
test('team invitation normalizes email to lowercase', function () {
|
||||
// Create a team
|
||||
$team = Team::factory()->create();
|
||||
|
||||
// Create invitation with mixed case email
|
||||
$invitation = TeamInvitation::create([
|
||||
'team_id' => $team->id,
|
||||
'uuid' => 'test-uuid-123',
|
||||
'email' => 'Test@Example.com', // Mixed case
|
||||
'role' => 'member',
|
||||
'link' => 'https://example.com/invite/test-uuid-123',
|
||||
'via' => 'link'
|
||||
]);
|
||||
// Create invitation with mixed case email
|
||||
$invitation = TeamInvitation::create([
|
||||
'team_id' => $team->id,
|
||||
'uuid' => 'test-uuid-123',
|
||||
'email' => 'Test@Example.com', // Mixed case
|
||||
'role' => 'member',
|
||||
'link' => 'https://example.com/invite/test-uuid-123',
|
||||
'via' => 'link',
|
||||
]);
|
||||
|
||||
// Verify email was normalized to lowercase
|
||||
$this->assertEquals('test@example.com', $invitation->email);
|
||||
}
|
||||
// Verify email was normalized to lowercase
|
||||
expect($invitation->email)->toBe('test@example.com');
|
||||
});
|
||||
|
||||
public function test_team_invitation_works_with_existing_user_email()
|
||||
{
|
||||
// Create a team
|
||||
$team = Team::factory()->create();
|
||||
test('team invitation works with existing user email', function () {
|
||||
// Create a team
|
||||
$team = Team::factory()->create();
|
||||
|
||||
// Create a user with lowercase email
|
||||
$user = User::factory()->create([
|
||||
'email' => 'test@example.com',
|
||||
'name' => 'Test User'
|
||||
]);
|
||||
// Create a user with lowercase email
|
||||
$user = User::factory()->create([
|
||||
'email' => 'test@example.com',
|
||||
'name' => 'Test User',
|
||||
]);
|
||||
|
||||
// Create invitation with mixed case email
|
||||
$invitation = TeamInvitation::create([
|
||||
'team_id' => $team->id,
|
||||
'uuid' => 'test-uuid-123',
|
||||
'email' => 'Test@Example.com', // Mixed case
|
||||
'role' => 'member',
|
||||
'link' => 'https://example.com/invite/test-uuid-123',
|
||||
'via' => 'link'
|
||||
]);
|
||||
// Create invitation with mixed case email
|
||||
$invitation = TeamInvitation::create([
|
||||
'team_id' => $team->id,
|
||||
'uuid' => 'test-uuid-123',
|
||||
'email' => 'Test@Example.com', // Mixed case
|
||||
'role' => 'member',
|
||||
'link' => 'https://example.com/invite/test-uuid-123',
|
||||
'via' => 'link',
|
||||
]);
|
||||
|
||||
// Verify the invitation email matches the user email (both normalized)
|
||||
$this->assertEquals($user->email, $invitation->email);
|
||||
// Verify the invitation email matches the user email (both normalized)
|
||||
expect($invitation->email)->toBe($user->email);
|
||||
|
||||
// Verify user lookup works
|
||||
$foundUser = User::whereEmail($invitation->email)->first();
|
||||
$this->assertNotNull($foundUser);
|
||||
$this->assertEquals($user->id, $foundUser->id);
|
||||
}
|
||||
}
|
||||
// Verify user lookup works
|
||||
$foundUser = User::whereEmail($invitation->email)->first();
|
||||
expect($foundUser)->not->toBeNull();
|
||||
expect($foundUser->id)->toBe($user->id);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user