Skip to content

Commit

Permalink
✅ Fix asset tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x committed Feb 7, 2025
1 parent 5a78f35 commit 4a1d957
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/Assets/AssetsHelpersTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Illuminate\Support\Facades\Facade;
use Roots\Acorn\Tests\Test\TestCase;

use function Roots\asset;
Expand All @@ -8,8 +9,13 @@

uses(TestCase::class);

beforeEach(function () {
Facade::setFacadeApplication(new \Roots\Acorn\Application);
});

it('asset() can access the default manifest', function () {
$app = new \Roots\Acorn\Application;

$app->singleton('config', fn () => new \Illuminate\Config\Repository([
'assets' => [
'default' => 'app',
Expand All @@ -29,13 +35,15 @@
],
],
]));

$app->register(\Roots\Acorn\Assets\AssetsServiceProvider::class);

assertMatchesSnapshot(asset('app.js')->uri());
});

it('asset() can access a specified manifest', function () {
$app = new \Roots\Acorn\Application;

$app->singleton('config', fn () => new \Illuminate\Config\Repository([
'assets' => [
'default' => 'app',
Expand All @@ -55,6 +63,7 @@
],
],
]));

$app->register(\Roots\Acorn\Assets\AssetsServiceProvider::class);

assertMatchesSnapshot(asset('editor.js', 'editor')->uri());
Expand All @@ -81,13 +90,15 @@
],
],
]));

$app->register(\Roots\Acorn\Assets\AssetsServiceProvider::class);

assertMatchesSnapshot(bundle('app')->js()->toJson());
});

it('bundle() can access a specified manifest', function () {
$app = new \Roots\Acorn\Application;

$app->singleton('config', fn () => new \Illuminate\Config\Repository([
'assets' => [
'default' => 'app',
Expand All @@ -107,6 +118,7 @@
],
],
]));

$app->register(\Roots\Acorn\Assets\AssetsServiceProvider::class);

assertMatchesSnapshot(bundle('editor', 'editor')->js()->toJson());
Expand Down

0 comments on commit 4a1d957

Please sign in to comment.