team = Team::factory()->create(); $this->user = User::factory()->create(); $this->team->members()->attach($this->user->id, ['role' => 'owner']); $this->actingAs($this->user); session(['currentTeam' => $this->team]); $this->project = Project::factory()->create(['team_id' => $this->team->id]); $this->environment = Environment::factory()->create(['project_id' => $this->project->id]); }); function configurationCheckerApplication(Environment $environment, array $attributes = []): Application { return Application::factory()->create(array_merge([ 'environment_id' => $environment->id, 'status' => 'running:healthy', 'build_command' => 'npm run build', 'fqdn' => 'https://example.com', ], $attributes)); } function markConfigurationCheckerApplicationDeployed(Application $application): void { $deployment = ApplicationDeploymentQueue::create([ 'application_id' => (string) $application->id, 'deployment_uuid' => (string) Str::uuid(), 'status' => 'finished', 'commit' => 'HEAD', ]); $application->markDeploymentConfigurationApplied($deployment); } it('does not render the notification for preview deployment toggles', function () { $application = configurationCheckerApplication($this->environment); markConfigurationCheckerApplicationDeployed($application); $application->settings->update(['is_preview_deployments_enabled' => true]); Livewire::test(ConfigurationChecker::class, ['resource' => $application->refresh()]) ->assertDontSee('The latest deployment is not using the current configuration') ->assertSet('isConfigurationChanged', false); }); it('renders the changed configuration labels without a second backend request', function () { $application = configurationCheckerApplication($this->environment); markConfigurationCheckerApplicationDeployed($application); $application->update(['build_command' => 'pnpm build']); Livewire::test(ConfigurationChecker::class, ['resource' => $application->refresh()]) ->assertSee('The latest configuration has not been applied') ->assertSee('Rebuild required.') ->assertSee('Build command'); $view = file_get_contents(resource_path('views/livewire/project/shared/configuration-checker.blade.php')); expect($view) ->toContain(':compact-after="5000"') ->toContain('position="top-right"') ->toContain(':compact-storage-key="$compactStorageKey"') ->toContain('wire:key="configuration-warning-{{ $currentConfigurationHash }}"') ->toContain('x-on:click="configurationDiffModalOpen = true"') ->not->toContain('$wire.refreshConfigurationChanges()'); }); it('supports timed compact popup notifications', function () { $view = file_get_contents(resource_path('views/components/popup-small.blade.php')); expect($view) ->toContain("\$position === 'top-right' ? 'top-16' : 'bottom-4'") ->toContain('compactAfter') ->toContain('compactStorageKey') ->toContain("localStorage.setItem(this.storageKey, 'compact')") ->toContain("localStorage.setItem(this.storageKey, 'icon')") ->toContain('localStorage.removeItem(key)') ->not->toContain('