diff options
| author | Sam Light <sam@lightscale.co.uk> | 2025-03-31 20:04:06 +0100 | 
|---|---|---|
| committer | Sam Light <samlight1994@gmail.com> | 2025-03-31 20:04:06 +0100 | 
| commit | 3c1056bdee2798d6bd5d9aad2f60ccbb8cb1d8d9 (patch) | |
| tree | f602844028360f8f518b847b39bf3fd19d25142a | |
| parent | b665c128ba6c650056305d7596d850c4aff2b59e (diff) | |
Grouped AssetsTest
| -rw-r--r-- | tests/Feature/AssetsTest.php | 124 | 
1 files changed, 64 insertions, 60 deletions
| diff --git a/tests/Feature/AssetsTest.php b/tests/Feature/AssetsTest.php index 887142c..7850081 100644 --- a/tests/Feature/AssetsTest.php +++ b/tests/Feature/AssetsTest.php @@ -3,76 +3,80 @@  use Lightscale\LaralightAssets\Assets;  use Lightscale\LaralightAssets\Manifest; -it('instantiates', function() { -    new Assets(); -})->throwsNoExceptions(); +describe('instance', function() { +    it('instantiates', function() { +        new Assets(); +    })->throwsNoExceptions(); -it('instantiates from container', function() { -    app(Assets::class); -})->throwsNoExceptions(); +    it('instantiates from container', function() { +        app(Assets::class); +    })->throwsNoExceptions(); -it('is singleton', function() { -    expect(app(Assets::class))->toBe(app(Assets::class)); +    it('is singleton', function() { +        expect(app(Assets::class))->toBe(app(Assets::class)); +    });  }); -it('adds manifests', function() { -    app(Assets::class)->addManifest( -        'main', -        new Manifest( -            public_path('dist/manifest.json'), -            '/dist', -        ), -        isDefault: true, -    ); -})->throwsNoExceptions(); +describe('manages manifests', function() { +    it('adds manifests', function() { +        app(Assets::class)->addManifest( +            'main', +            new Manifest( +                public_path('dist/manifest.json'), +                '/dist', +            ), +            isDefault: true, +        ); +    })->throwsNoExceptions(); -it('registers manifests', function() { -    app(Assets::class)->registerManifest( -        'main', public_path('dist/manifest.json'), '/dist', isDefault: true, -    ); -})->throwsNoExceptions(); +    it('registers manifests', function() { +        app(Assets::class)->registerManifest( +            'main', public_path('dist/manifest.json'), '/dist', isDefault: true, +        ); +    })->throwsNoExceptions(); -it('gets manifests', function() { -    $assets = app(Assets::class); -    $assets->registerManifest( -        'main', public_path('dist/manifest.json'), '/dist', isDefault: true, -    ); +    it('gets manifests', function() { +        $assets = app(Assets::class); +        $assets->registerManifest( +            'main', public_path('dist/manifest.json'), '/dist', isDefault: true, +        ); -    expect($assets->getManifests()) -        ->toHaveLength(1) -        ->toContainOnlyInstancesOf(Manifest::class); -}); +        expect($assets->getManifests()) +            ->toHaveLength(1) +            ->toContainOnlyInstancesOf(Manifest::class); +    }); -it('gets manifest', function() { -    $assets = app(Assets::class); -    $manifest = new Manifest( -        public_path('dist/manifest.json'), -        '/dist', -    ); -    $name = 'main'; -    $assets->addManifest($name, $manifest, true); +    it('gets manifest', function() { +        $assets = app(Assets::class); +        $manifest = new Manifest( +            public_path('dist/manifest.json'), +            '/dist', +        ); +        $name = 'main'; +        $assets->addManifest($name, $manifest, true); -    expect($assets->getManifest($name))->toBe($manifest); -}); +        expect($assets->getManifest($name))->toBe($manifest); +    }); -it('gets default manifest', function() { -    $assets = app(Assets::class); -    $manifest = new Manifest( -        public_path('dist/manifest.json'), -        '/dist', -    ); -    $name = 'main'; -    $assets->addManifest($name, $manifest, true); +    it('gets default manifest', function() { +        $assets = app(Assets::class); +        $manifest = new Manifest( +            public_path('dist/manifest.json'), +            '/dist', +        ); +        $name = 'main'; +        $assets->addManifest($name, $manifest, true); -    expect($assets->getDefaultManifest())->toBe($manifest); -}); +        expect($assets->getDefaultManifest())->toBe($manifest); +    }); -it('throws exception missing manifest', function() { -    $assets = app(Assets::class); -    $assets->getManifest('main'); -})->throws(Exception::class); +    it('throws exception missing manifest', function() { +        $assets = app(Assets::class); +        $assets->getManifest('main'); +    })->throws(Exception::class); -it('throws exception without default', function() { -    $assets = app(Assets::class); -    $assets->getDefaultManifest(); -})->throws(Error::class); +    it('throws exception without default', function() { +        $assets = app(Assets::class); +        $assets->getDefaultManifest(); +    })->throws(Error::class); +}); | 
