From cd9603e113eb4fc9ddd7bc1c752d6684825416b0 Mon Sep 17 00:00:00 2001 From: Xavier FACQ Date: Fri, 11 Aug 2023 17:27:07 +0200 Subject: [PATCH] Fix/adoptium 2086 uniformize extension of proposed download (#2088) * [adoptium-2086] Uniformize extension of proposed download * Fix tests to be all greeen * Keep same notation without ';' at end of line --- .../MarketplaceDownloadTable.test.tsx.snap | 4 ++-- .../__snapshots__/fetchTemurinArchive.test.tsx.snap | 10 +++++----- .../__snapshots__/fetchTemurinReleases.test.tsx.snap | 6 +++--- src/util/__tests__/fetchExtension.test.tsx | 4 ++-- src/util/fetchExtension.tsx | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/MarketplaceDownloadTable/__tests__/__snapshots__/MarketplaceDownloadTable.test.tsx.snap b/src/components/MarketplaceDownloadTable/__tests__/__snapshots__/MarketplaceDownloadTable.test.tsx.snap index f044e2ea6..57023bfea 100644 --- a/src/components/MarketplaceDownloadTable/__tests__/__snapshots__/MarketplaceDownloadTable.test.tsx.snap +++ b/src/components/MarketplaceDownloadTable/__tests__/__snapshots__/MarketplaceDownloadTable.test.tsx.snap @@ -226,7 +226,7 @@ exports[`MarketplaceDownloadTable component > renders correctly 1`] = ` /> - tar.gz + .tar.gz @@ -407,7 +407,7 @@ exports[`MarketplaceDownloadTable component > renders correctly 1`] = ` /> - tar.gz + .tar.gz diff --git a/src/hooks/__tests__/__snapshots__/fetchTemurinArchive.test.tsx.snap b/src/hooks/__tests__/__snapshots__/fetchTemurinArchive.test.tsx.snap index 9f1f52706..cbc89cc4a 100644 --- a/src/hooks/__tests__/__snapshots__/fetchTemurinArchive.test.tsx.snap +++ b/src/hooks/__tests__/__snapshots__/fetchTemurinArchive.test.tsx.snap @@ -11,7 +11,7 @@ exports[`getAssetsForVersion > returns valid JSON - ea 1`] = ` { "architecture": "arch_mock", "checksum": "checksum_mock", - "extension": "tar.gz", + "extension": ".tar.gz", "link": "https://link_mock/", "os": "os_mock", "size": 0, @@ -39,7 +39,7 @@ exports[`getAssetsForVersion > returns valid JSON - with installers 1`] = ` { "architecture": "arch_mock", "checksum": "checksum_mock", - "extension": "tar.gz", + "extension": ".tar.gz", "installer_checksum": "installer_checksum_mock", "installer_extension": ".msi", "installer_link": "https://installer_link_mock/", @@ -71,7 +71,7 @@ exports[`getAssetsForVersion > returns valid JSON - with release notes 1`] = ` { "architecture": "arch_mock", "checksum": "checksum_mock", - "extension": "tar.gz", + "extension": ".tar.gz", "link": "https://link_mock/", "os": "os_mock", "size": 0, @@ -100,7 +100,7 @@ exports[`getAssetsForVersion > returns valid JSON - with source 1`] = ` { "architecture": "arch_mock", "checksum": "checksum_mock", - "extension": "tar.gz", + "extension": ".tar.gz", "link": "https://link_mock/", "os": "os_mock", "size": 0, @@ -129,7 +129,7 @@ exports[`getAssetsForVersion > returns valid JSON 1`] = ` { "architecture": "arch_mock", "checksum": "checksum_mock", - "extension": "tar.gz", + "extension": ".tar.gz", "link": "https://link_mock/", "os": "os_mock", "size": 0, diff --git a/src/hooks/__tests__/__snapshots__/fetchTemurinReleases.test.tsx.snap b/src/hooks/__tests__/__snapshots__/fetchTemurinReleases.test.tsx.snap index 2d059129e..4d1229f90 100644 --- a/src/hooks/__tests__/__snapshots__/fetchTemurinReleases.test.tsx.snap +++ b/src/hooks/__tests__/__snapshots__/fetchTemurinReleases.test.tsx.snap @@ -7,7 +7,7 @@ exports[`loadLatestAssets > returns valid JSON + installer 1`] = ` "binaries": [ { "checksum": "checksum_mock", - "extension": "tar.gz", + "extension": ".tar.gz", "installer_checksum": "installer_checksum_mock", "installer_extension": ".msi", "installer_link": "https://installer_link_mock/", @@ -33,7 +33,7 @@ exports[`loadLatestAssets > returns valid JSON 1`] = ` "binaries": [ { "checksum": "checksum_mock", - "extension": "tar.gz", + "extension": ".tar.gz", "link": "https://link_mock/", "size": 0, "type": "JDK", @@ -55,7 +55,7 @@ exports[`loadLatestAssets > source image is processed correctly 1`] = ` "binaries": [ { "checksum": "checksum_mock", - "extension": "tar.gz", + "extension": ".tar.gz", "link": "https://link_mock/", "size": 0, "type": "JDK", diff --git a/src/util/__tests__/fetchExtension.test.tsx b/src/util/__tests__/fetchExtension.test.tsx index 017d65af0..c4282a404 100644 --- a/src/util/__tests__/fetchExtension.test.tsx +++ b/src/util/__tests__/fetchExtension.test.tsx @@ -3,11 +3,11 @@ import { describe, expect, it } from 'vitest' describe("fetchExtension", () => { it("should convert file.tar.gz to tar.gz", () => { - expect(fetchExtension("file.tar.gz")).toBe("tar.gz"); + expect(fetchExtension("file.tar.gz")).toBe(".tar.gz"); }); it("should convert file.tar.xz to tar.xz", () => { - expect(fetchExtension("file.tar.xz")).toBe("tar.xz"); + expect(fetchExtension("file.tar.xz")).toBe(".tar.xz"); }); it("should convert file.zip to .zip", () => { diff --git a/src/util/fetchExtension.tsx b/src/util/fetchExtension.tsx index fdd4bcd07..0ed8189e4 100644 --- a/src/util/fetchExtension.tsx +++ b/src/util/fetchExtension.tsx @@ -2,9 +2,9 @@ export function fetchExtension (filename: string) { let extension = `.${filename.split('.').pop()}` // Workaround to prevent extension returning as .gz if (extension === '.gz') { - extension = 'tar.gz' + extension = '.tar.gz' } else if (extension === '.xz') { - extension = 'tar.xz' + extension = '.tar.xz' } return extension }