Skip to content

Commit

Permalink
Update AssetServiceUnitTest.php
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Jul 26, 2024
1 parent 78a748e commit 10407d4
Showing 1 changed file with 0 additions and 67 deletions.
67 changes: 0 additions & 67 deletions packages/framework/tests/Unit/AssetServiceUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,73 +21,6 @@ protected function setUp(): void
self::mockConfig();
}

public function testVersionStringConstant()
{
$this->assertSame('v3.4', AssetService::HYDEFRONT_VERSION);
}

public function testServiceHasVersionString()
{
$this->assertIsString((new AssetService())->version());
}

public function testVersionStringDefaultsToConstant()
{
$this->assertSame(AssetService::HYDEFRONT_VERSION, (new AssetService())->version());
}

public function testVersionCanBeSetInConfig()
{
self::mockConfig(['hyde.hydefront_version' => '1.0.0']);
$this->assertSame('1.0.0', (new AssetService())->version());
}

public function testCdnPatternConstant()
{
$this->assertSame('https://cdn.jsdelivr.net/npm/hydefront@{{ $version }}/dist/{{ $file }}', AssetService::HYDEFRONT_CDN_URL);
}

public function testCanSetCustomCdnUrlInConfig()
{
self::mockConfig(['hyde.hydefront_url' => 'https://example.com']);
$this->assertSame('https://example.com', (new AssetService())->cdnLink(''));
}

public function testCanUseCustomCdnUrlWithVersion()
{
self::mockConfig(['hyde.hydefront_url' => '{{ $version }}']);
$this->assertSame('v3.4', (new AssetService())->cdnLink(''));
}

public function testCanUseCustomCdnUrlWithFile()
{
self::mockConfig(['hyde.hydefront_url' => '{{ $file }}']);
$this->assertSame('styles.css', (new AssetService())->cdnLink('styles.css'));
}

public function testCanUseCustomCdnUrlWithVersionAndFile()
{
self::mockConfig(['hyde.hydefront_url' => '{{ $version }}/{{ $file }}']);
$this->assertSame('v3.4/styles.css', (new AssetService())->cdnLink('styles.css'));
}

public function testCanUseCustomCdnUrlWithCustomVersion()
{
self::mockConfig([
'hyde.hydefront_url' => '{{ $version }}',
'hyde.hydefront_version' => '1.0.0',
]);
$this->assertSame('1.0.0', (new AssetService())->cdnLink(''));
}

public function testCdnLinkHelper()
{
$this->assertSame(
'https://cdn.jsdelivr.net/npm/[email protected]/dist/styles.css',
(new AssetService())->cdnLink('styles.css')
);
}

public function testHasMediaFileHelper()
{
$this->assertFalse((new AssetService())->hasMediaFile('styles.css'));
Expand Down

0 comments on commit 10407d4

Please sign in to comment.