Skip to content

Commit

Permalink
Simplify test
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Dec 8, 2024
1 parent 8af55ed commit fb3865c
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions packages/framework/tests/Unit/Facades/ViteFacadeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,18 @@ public function testAssetsMethodGeneratesCorrectHtmlForMultipleFiles()
/**
* @dataProvider cssFileExtensionsProvider
*/
public function testAssetsMethodSupportsAllCssFileExtensions(string $extension, bool $shouldBeUsed)
public function testAssetsMethodSupportsAllCssFileExtensions(string $extension)
{
$html = Vite::assets(["resources/css/app.$extension"]);

$expected = $shouldBeUsed
? '<script src="http://localhost:5173/@vite/client" type="module"></script><link rel="stylesheet" href="http://localhost:5173/resources/css/app.'.$extension.'">'
: '<script src="http://localhost:5173/@vite/client" type="module"></script>';
if ($extension !== 'js') {
$expected = '<script src="http://localhost:5173/@vite/client" type="module"></script><link rel="stylesheet" href="http://localhost:5173/resources/css/app.'.$extension.'">';

$this->assertSame($expected, (string) $html);
$this->assertStringContainsString('stylesheet', (string) $html);
$this->assertSame($expected, (string) $html);
} else {
$this->assertStringNotContainsString('stylesheet', (string) $html);
}
}

public function testAssetMethodReturnsHtmlString()
Expand Down Expand Up @@ -164,17 +167,15 @@ public function testAssetMethodDoesNotIncludeUnknownExtensions()
public static function cssFileExtensionsProvider(): array
{
return [
['css', true],
['less', true],
['sass', true],
['scss', true],
['styl', true],
['stylus', true],
['pcss', true],
['postcss', true],
['foo', false],
['txt', false],
['html', false],
['css'],
['less'],
['sass'],
['scss'],
['styl'],
['stylus'],
['pcss'],
['postcss'],
['js'],
];
}
}

0 comments on commit fb3865c

Please sign in to comment.