Skip to content

Commit

Permalink
Move up and improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Dec 8, 2024
1 parent 5508d35 commit 079913d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/framework/tests/Unit/Facades/ViteFacadeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ public function testRunningReturnsFalseWhenViteHotFileDoesNotExist()
$this->assertFalse(Vite::running());
}

public function testAssetsMethodReturnsHtmlString()
{
$this->assertInstanceOf(HtmlString::class, Vite::assets([]));
$this->assertInstanceOf(HtmlString::class, Vite::assets(['foo.js']));

$this->assertEquals(new HtmlString('<script src="http://localhost:5173/@vite/client" type="module"></script>'), Vite::assets([]));
$this->assertEquals(new HtmlString('<script src="http://localhost:5173/@vite/client" type="module"></script><script src="http://localhost:5173/foo.js" type="module"></script>'), Vite::assets(['foo.js']));
}

public function testAssetsMethodGeneratesCorrectHtmlForJavaScriptFiles()
{
$html = Vite::assets(['resources/js/app.js']);
Expand Down Expand Up @@ -89,9 +98,4 @@ public function testAssetsMethodGeneratesCorrectHtmlForMultipleFiles()

$this->assertSame($expected, (string) $html);
}

public function testAssetsMethodReturnsHtmlString()
{
$this->assertInstanceOf(HtmlString::class, Vite::assets([]));
}
}

0 comments on commit 079913d

Please sign in to comment.