mirror of
https://github.com/coollabsio/coolify.git
synced 2026-10-29 01:54:37 +08:00
- Delete Blade components, component classes, Livewire components and views that nothing uses after the redesign. - Delete tests that only compare Blade/CSS source text; keep the source checks for authorization gates, stable wire:key values and escaping. - Update stale tests to the current UI and behaviour. - Update DESIGN.md to the current navigation and layout. - Add a lesson: test behaviour, not source markup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
63 lines
1.7 KiB
PHP
63 lines
1.7 KiB
PHP
<?php
|
|
|
|
use App\Livewire\SettingsEmail;
|
|
use App\Models\InstanceSettings;
|
|
use App\Models\Team;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Once;
|
|
use Livewire\Livewire;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
function setupInstanceAdminWithTransactionalEmail(): User
|
|
{
|
|
$rootTeam = Team::find(0) ?? Team::factory()->create(['id' => 0]);
|
|
InstanceSettings::forceCreate([
|
|
'id' => 0,
|
|
'smtp_enabled' => true,
|
|
'smtp_from_address' => 'hi@localhost.com',
|
|
'smtp_from_name' => 'Coolify',
|
|
'smtp_host' => 'coolify-mail',
|
|
'smtp_port' => 1025,
|
|
]);
|
|
Once::flush();
|
|
|
|
$user = User::factory()->create();
|
|
$rootTeam->members()->attach($user->id, ['role' => 'admin']);
|
|
|
|
return $user;
|
|
}
|
|
|
|
test('send test is available when transactional email is enabled', function () {
|
|
$user = setupInstanceAdminWithTransactionalEmail();
|
|
|
|
$this->actingAs($user);
|
|
session(['currentTeam' => ['id' => 0]]);
|
|
|
|
Livewire::test(SettingsEmail::class)
|
|
->assertOk()
|
|
->assertSee('Sender')
|
|
->assertSee('Send test');
|
|
});
|
|
|
|
test('send test is not rendered when transactional email is disabled', function () {
|
|
$rootTeam = Team::find(0) ?? Team::factory()->create(['id' => 0]);
|
|
InstanceSettings::forceCreate([
|
|
'id' => 0,
|
|
'smtp_enabled' => false,
|
|
'resend_enabled' => false,
|
|
]);
|
|
Once::flush();
|
|
|
|
$user = User::factory()->create();
|
|
$rootTeam->members()->attach($user->id, ['role' => 'admin']);
|
|
|
|
$this->actingAs($user);
|
|
session(['currentTeam' => ['id' => 0]]);
|
|
|
|
Livewire::test(SettingsEmail::class)
|
|
->assertOk()
|
|
->assertDontSee('Send test');
|
|
});
|