test: use TrmnlPipeline::fake() to speed up test suite

This commit is contained in:
Benjamin Nussbaum 2025-09-24 19:24:55 +02:00
parent 42b515e322
commit a1a57014b6
9 changed files with 119 additions and 102 deletions

View file

@ -7,6 +7,7 @@ use App\Models\Playlist;
use App\Models\PlaylistItem;
use App\Models\Plugin;
use App\Models\User;
use Bnussbau\TrmnlPipeline\TrmnlPipeline;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Facades\Storage;
use Laravel\Sanctum\Sanctum;
@ -14,6 +15,7 @@ use Laravel\Sanctum\Sanctum;
uses(Illuminate\Foundation\Testing\RefreshDatabase::class);
beforeEach(function () {
TrmnlPipeline::fake();
Storage::fake('public');
Storage::disk('public')->makeDirectory('/images/generated');
});
@ -573,7 +575,7 @@ test('plugin caches image until data is stale', function () {
expect($thirdResponse['filename'])
->not->toBe($firstResponse['filename']);
})->skipOnCi();
});
test('plugins in playlist are rendered in order', function () {
// Create source device with a playlist
@ -677,7 +679,7 @@ test('plugins in playlist are rendered in order', function () {
$thirdResponse->assertOk();
expect($thirdResponse['filename'])
->not->toBe($secondResponse['filename']);
})->skipOnCi();
});
test('display endpoint updates last_refreshed_at timestamp', function () {
$device = Device::factory()->create([
@ -787,7 +789,7 @@ test('display endpoint handles mashup playlist items correctly', function () {
// Verify the playlist item was marked as displayed
$playlistItem->refresh();
expect($playlistItem->last_displayed_at)->not->toBeNull();
})->skipOnCi();
});
test('device in sleep mode returns sleep image and correct refresh rate', function () {
$device = Device::factory()->create([