Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
devajmeireles committed Aug 29, 2023
1 parent caa721a commit 856485f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/Feature/Http/Livewire/Presence/FilterTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use App\Exports\Presence\PresenceExport;
use App\Models\Presence;
use Maatwebsite\Excel\Facades\Excel;

use function Pest\Laravel\get;

beforeEach(fn () => createTestUser());

it('can generate export', function () {
Excel::fake();

$file = sprintf('presenças-%s.xlsx', now()->format('Y-m-d_H:i'));
$presence = Presence::factory()->create();

get(route('admin.presences.export'));

Excel::assertDownloaded($file, function (PresenceExport $export) use ($presence) {
return $export->collection()->contains($presence);
});
});

it('can generate empty export', function () {
Excel::fake();

$file = sprintf('presenças-%s.xlsx', now()->format('Y-m-d_H:i'));

get(route('admin.presences.export'));

Excel::assertDownloaded($file, function (PresenceExport $export) {
return $export->collection()->isEmpty();
});
});

0 comments on commit 856485f

Please sign in to comment.