summaryrefslogtreecommitdiff
path: root/tests/Feature
diff options
context:
space:
mode:
authorSam Light <sam@lightscale.co.uk>2025-03-31 00:49:43 +0100
committerSam Light <samlight1994@gmail.com>2025-03-31 00:49:43 +0100
commitc85ac39b61875f6b570612739b0244160243d263 (patch)
treed90b0955b11aabe26a8fa218e021cc5751939265 /tests/Feature
parent28e2f2c50c902d6ea09b2d6941c9e71ea07b23eb (diff)
Manifest testing
Diffstat (limited to 'tests/Feature')
-rw-r--r--tests/Feature/ManifestTest.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/Feature/ManifestTest.php b/tests/Feature/ManifestTest.php
index a9e1108..5a05764 100644
--- a/tests/Feature/ManifestTest.php
+++ b/tests/Feature/ManifestTest.php
@@ -2,6 +2,32 @@
use Lightscale\LaralightAssets\Manifest;
+$path = fn() => public_path('dist/manifest.json');
+
it('instantiates', function() {
new Manifest('test.json', '/dist');
})->throwsNoExceptions();
+
+it('generates dir from file', function() use ($path) {
+ $manifest = new Manifest($path(), '/dist');
+ expect($manifest->getDir())
+ ->toBe(public_path('/dist'));
+});
+
+it('gets file', function() use ($path) {
+ $manifest = new Manifest($path(), '/dist');
+ expect($manifest->getFile('main.css'))
+ ->toBe('main.testing.css');
+});
+
+it('gets url', function() use ($path) {
+ $manifest = new Manifest($path(), '/dist');
+ expect($manifest->getUrl('main.css'))
+ ->toBe(asset('/dist/main.testing.css'));
+});
+
+it('gets paths', function() use ($path) {
+ $manifest = new Manifest($path(), '/dist');
+ expect($manifest->getPath('main.css'))
+ ->toBe(public_path('/dist/main.testing.css'));
+});