Skip to content

Commit

Permalink
Fix/adoptium 2086 uniformize extension of proposed download (#2088)
Browse files Browse the repository at this point in the history
* [adoptium-2086] Uniformize extension of proposed download

* Fix tests to be all greeen

* Keep same notation without ';' at end of line
  • Loading branch information
xavierfacq authored Aug 11, 2023
1 parent 47cb127 commit cd9603e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ exports[`MarketplaceDownloadTable component > renders correctly 1`] = `
/>
</svg>
tar.gz
.tar.gz
</a>
</td>
</tr>
Expand Down Expand Up @@ -407,7 +407,7 @@ exports[`MarketplaceDownloadTable component > renders correctly 1`] = `
/>
</svg>
tar.gz
.tar.gz
</a>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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/",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/util/__tests__/fetchExtension.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/util/fetchExtension.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit cd9603e

Please sign in to comment.