Files
coolify/tests/Feature/NotificationRestartLimitSettingTest.php
T
Andras BacsaiandClaude Opus 5.5 a79ee909c6 chore: remove unused components and markup-only tests
- 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>
2026-09-28 00:18:16 +02:00

33 lines
1.6 KiB
PHP

<?php
it('persists a restart limit notification preference for every channel', function (string $channel) {
$studly = Str::studly($channel);
$component = file_get_contents(app_path("Livewire/Notifications/{$studly}.php"));
$model = file_get_contents(app_path('Models/'.$studly.'NotificationSettings.php'));
$column = "restart_limit_reached_{$channel}_notifications";
$property = "restartLimitReached{$studly}Notifications";
expect($component)
->toContain("public bool \${$property} = true;")
->toContain("\$this->settings->{$column} = \$this->{$property};")
->toContain("\$this->{$property} = \$this->settings->{$column};")
->and($model)
->toContain("'{$column}'");
})->with(['email', 'discord', 'telegram', 'slack', 'pushover', 'webhook']);
it('enables restart limit notifications by default in every channel migration', function () {
$migrations = collect(glob(database_path('migrations/*_add_restart_limit_reached_notifications_to_*')));
expect($migrations)->toHaveCount(6);
$migrations->each(fn (string $migration) => expect(file_get_contents($migration))->toContain('->default(true)'));
});
it('uses the inline validator facade for notification API updates', function () {
$controller = file_get_contents(app_path('Http/Controllers/Api/NotificationsController.php'));
expect($controller)
->toContain('use Illuminate\\Support\\Facades\\Validator;')
->toContain("Validator::make(\$body, \$config['rules'])")
->not->toContain("customApiValidator(\$body, \$config['rules'])");
});