forked from coollabsio/coolify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotifyOutdatedTraefikServersJobTest.php
More file actions
56 lines (42 loc) · 1.66 KB
/
NotifyOutdatedTraefikServersJobTest.php
File metadata and controls
56 lines (42 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?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');
});