From 6f305eebb8e7fad0687d0cb3796e2c6c0fc38614 Mon Sep 17 00:00:00 2001 From: Chris Kankiewicz Date: Tue, 18 Mar 2025 13:59:03 -0700 Subject: [PATCH] Added ViteTest --- tests/ViewFunctions/ViteTest.php | 43 +++++++++++++++++++++++ tests/_files/app/assets/manifest.json | 13 +++++++ tests/_files/app/assets/mix-manifest.json | 4 --- 3 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 tests/ViewFunctions/ViteTest.php create mode 100644 tests/_files/app/assets/manifest.json delete mode 100644 tests/_files/app/assets/mix-manifest.json diff --git a/tests/ViewFunctions/ViteTest.php b/tests/ViewFunctions/ViteTest.php new file mode 100644 index 0000000..ed910a9 --- /dev/null +++ b/tests/ViewFunctions/ViteTest.php @@ -0,0 +1,43 @@ +container->set('asset_path', $this->filePath('.')); + + $vite = $this->container->get(Vite::class); + + $tags = $vite(['app/resources/js/app.js', 'app/resources/css/app.css']); + + $this->assertSame(<< + + + HTML, $tags); + } + + #[Test] + public function it_can_get_tags_for_a_list_of_assets_when_in_build_mode(): void + { + $this->container->set('assets_path', $this->filePath('app/assets')); + + $vite = $this->container->get(Vite::class); + + $tags = $vite(['app/resources/js/app.js', 'app/resources/css/app.css']); + + $this->assertSame(<< + + HTML, $tags); + } +} diff --git a/tests/_files/app/assets/manifest.json b/tests/_files/app/assets/manifest.json new file mode 100644 index 0000000..d9fa526 --- /dev/null +++ b/tests/_files/app/assets/manifest.json @@ -0,0 +1,13 @@ +{ + "app/resources/css/app.css": { + "file": "app/assets/app-DcdLJcW2.css", + "src": "app/resources/css/app.css", + "isEntry": true + }, + "app/resources/js/app.js": { + "file": "app/assets/app-DwN9UvfZ.js", + "name": "app", + "src": "app/resources/js/app.js", + "isEntry": true + } +} diff --git a/tests/_files/app/assets/mix-manifest.json b/tests/_files/app/assets/mix-manifest.json deleted file mode 100644 index 64b8086..0000000 --- a/tests/_files/app/assets/mix-manifest.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "/app.css": "/app.css?id=417c7a9bc03852aafb27", - "/app.js": "/app.js?id=6753a7269276c7b52692" -}