diff --git a/tests/Pest/FaviconTest.php b/tests/Pest/FaviconTest.php index 72143a2..2c9ca40 100644 --- a/tests/Pest/FaviconTest.php +++ b/tests/Pest/FaviconTest.php @@ -3,8 +3,21 @@ use ArchTech\SEO\Commands\GenerateFaviconsCommand; use function Pest\Laravel\artisan; +use function PHPUnit\Framework\assertFileDoesNotExist; use function PHPUnit\Framework\assertFileExists; +// Clean up generated files +beforeEach(function () { + $files = [ + 'favicon.ico', + 'favicon.png', + ]; + + foreach ($files as $file) { + @unlink(public_path($file)); + } +}); + test('it should generate two favicons', function () { seo()->favicon(); @@ -24,4 +37,7 @@ test('it should fail because the from path is incorrect', function () { artisan(GenerateFaviconsCommand::class, [ 'from' => 'i/dont/exist.png', ])->assertFailed(); + + assertFileDoesNotExist(public_path('favicon.ico')); + assertFileDoesNotExist(public_path('favicon.png')); });