mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
test: use TrmnlPipeline::fake() to speed up test suite
This commit is contained in:
parent
42b515e322
commit
a1a57014b6
9 changed files with 119 additions and 102 deletions
|
|
@ -2,11 +2,13 @@
|
|||
|
||||
use App\Jobs\GenerateScreenJob;
|
||||
use App\Models\Device;
|
||||
use Bnussbau\TrmnlPipeline\TrmnlPipeline;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
uses(Illuminate\Foundation\Testing\RefreshDatabase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
TrmnlPipeline::fake();
|
||||
Storage::fake('public');
|
||||
Storage::disk('public')->makeDirectory('/images/generated');
|
||||
});
|
||||
|
|
@ -23,7 +25,7 @@ test('it generates screen images and updates device', function () {
|
|||
// Assert both PNG and BMP files were created
|
||||
$uuid = $device->current_screen_image;
|
||||
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
|
||||
})->skipOnCi();
|
||||
});
|
||||
|
||||
test('it cleans up unused images', function () {
|
||||
// Create some test devices with images
|
||||
|
|
@ -45,7 +47,7 @@ test('it cleans up unused images', function () {
|
|||
Storage::disk('public')->assertMissing('/images/generated/uuid-to-be-replaced.bmp');
|
||||
Storage::disk('public')->assertMissing('/images/generated/inactive-uuid.png');
|
||||
Storage::disk('public')->assertMissing('/images/generated/inactive-uuid.bmp');
|
||||
})->skipOnCi();
|
||||
});
|
||||
|
||||
test('it preserves gitignore file during cleanup', function () {
|
||||
Storage::disk('public')->put('/images/generated/.gitignore', '*');
|
||||
|
|
@ -55,4 +57,4 @@ test('it preserves gitignore file during cleanup', function () {
|
|||
$job->handle();
|
||||
|
||||
Storage::disk('public')->assertExists('/images/generated/.gitignore');
|
||||
})->skipOnCi();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue