forked from alexjustesen/speedtest-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScheduledSpeedtestModeTest.php
More file actions
35 lines (27 loc) · 927 Bytes
/
ScheduledSpeedtestModeTest.php
File metadata and controls
35 lines (27 loc) · 927 Bytes
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
<?php
use App\Actions\CheckForScheduledSpeedtests;
use App\Models\Result;
use Illuminate\Support\Facades\Bus;
use Illuminate\Support\Facades\Cache;
beforeEach(function () {
Cache::flush();
Bus::fake();
});
test('runs single speedtest when mode random', function () {
config()->set('speedtest.schedule', '* * * * *');
config()->set('speedtest.mode', 'random');
config()->set('speedtest.servers', '1,2');
CheckForScheduledSpeedtests::run();
expect(Result::count())->toBe(1);
});
test('runs sequential speedtests when mode sequential', function () {
config()->set('speedtest.schedule', '* * * * *');
config()->set('speedtest.mode', 'sequential');
config()->set('speedtest.servers', '1,2');
CheckForScheduledSpeedtests::run();
expect(Result::count())->toBe(2);
expect(Result::orderBy('id')->pluck('data->server->id')->toArray())->toBe([
1,
2,
]);
});