coolify/tests/Unit/NotifyOutdatedTraefikServersJobTest.php
Andras Bacsai 6dbe58f22b feat(proxy): enhance Traefik version notifications to show patch and minor upgrades
- Store both patch update and newer minor version information simultaneously
- Display patch update availability alongside minor version upgrades in notifications
- Add newer_branch_target and newer_branch_latest fields to traefik_outdated_info
- Update all notification channels (Discord, Telegram, Slack, Pushover, Email, Webhook)
- Show minor version in format (e.g., v3.6) for upgrade targets instead of patch version
- Enhance UI callouts with clearer messaging about available upgrades
- Remove verbose logging in favor of cleaner code structure
- Handle edge case where SSH command returns empty response

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 14:53:49 +01:00

57 lines
1.7 KiB
PHP

<?php
use App\Jobs\NotifyOutdatedTraefikServersJob;
it('has correct queue and retry configuration', function () {
$job = new NotifyOutdatedTraefikServersJob;
expect($job->tries)->toBe(3);
});
it('handles servers with null traefik_outdated_info gracefully', function () {
// Create a mock server with null traefik_outdated_info
$server = \Mockery::mock('App\Models\Server')->makePartial();
$server->traefik_outdated_info = null;
// Accessing the property should not throw an error
$result = $server->traefik_outdated_info;
expect($result)->toBeNull();
});
it('handles servers with traefik_outdated_info data', function () {
$expectedInfo = [
'current' => '3.5.0',
'latest' => '3.6.2',
'type' => 'minor_upgrade',
'upgrade_target' => 'v3.6',
'checked_at' => '2025-11-14T10:00:00Z',
];
$server = \Mockery::mock('App\Models\Server')->makePartial();
$server->traefik_outdated_info = $expectedInfo;
// Should return the outdated info
$result = $server->traefik_outdated_info;
expect($result)->toBe($expectedInfo);
});
it('handles servers with patch update info without upgrade_target', function () {
$expectedInfo = [
'current' => '3.5.0',
'latest' => '3.5.2',
'type' => 'patch_update',
'checked_at' => '2025-11-14T10:00:00Z',
];
$server = \Mockery::mock('App\Models\Server')->makePartial();
$server->traefik_outdated_info = $expectedInfo;
// Should return the outdated info without upgrade_target
$result = $server->traefik_outdated_info;
expect($result)->toBe($expectedInfo);
expect($result)->not->toHaveKey('upgrade_target');
});