clupilot/app/tests/Feature/Pages/SettingsPageTest.php

40 lines
1.2 KiB
PHP

<?php
use App\Models\User;
use function Pest\Laravel\actingAs;
use function Pest\Laravel\get;
use function Pest\Livewire\livewire;
it('redirects guests to login', function () {
get(route('settings.index'))->assertRedirect(route('login'));
});
it('renders settings page chrome', function () {
$user = User::factory()->create(['email_verified_at' => now()]);
actingAs($user)->get(route('settings.index'))
->assertStatus(200)
->assertSeeText('Einstellungen')
->assertSeeText('Workspace')
->assertSeeText('Benachrichtigungen')
->assertSeeText('Billing')
->assertSeeText('API')
->assertSeeText('Danger Zone');
});
it('switches sections', function () {
livewire('pages.settings.index')
->assertSet('section', 'workspace')
->call('setSection', 'billing')
->assertSet('section', 'billing')
->assertSeeText('PRO Plan')
->call('setSection', 'danger')
->assertSeeText('Workspace löschen');
});
it('persists workspace fields in form state', function () {
livewire('pages.settings.index')
->set('workspaceName', 'Neue GmbH')
->assertSet('workspaceName', 'Neue GmbH');
});