From 017b15fc61963807c187f4a1458789cd704ec4af Mon Sep 17 00:00:00 2001 From: Xavier FACQ Date: Wed, 27 Nov 2024 23:23:43 +0100 Subject: [PATCH] Correctly display checksum and buttons (#3259) * [issue-3221] Pb when checksum is not available * Change all calls * Improve codecov * Set text = Not available * Remove unused import * Fix dowload table presentation / deal with sha265sum and sha256sum * update snapshots * update snapshots 2 --- src/__fixtures__/hooks.tsx | 8 ++-- .../MarketplaceDownloadTable.test.tsx | 6 ++- .../MarketplaceDownloadTable.test.tsx.snap | 32 +++++++------- .../MarketplaceDownloadTable/index.tsx | 10 ++--- .../TemurinDownloadTable.test.tsx.snap | 42 +++++++++---------- src/components/TemurinDownloadTable/index.tsx | 6 +-- .../fetchLatestTemurin.test.tsx.snap | 4 +- src/hooks/fetchMarketplace.tsx | 4 ++ .../__snapshots__/download.test.tsx.snap | 4 +- src/pages/__tests__/download.test.tsx | 4 +- 10 files changed, 64 insertions(+), 56 deletions(-) diff --git a/src/__fixtures__/hooks.tsx b/src/__fixtures__/hooks.tsx index 7d977955d..e76992f62 100644 --- a/src/__fixtures__/hooks.tsx +++ b/src/__fixtures__/hooks.tsx @@ -55,7 +55,7 @@ export const createRandomMarketplaceRelease = (installer, id): MarketplaceReleas package: { name: 'name_mock.tar.gz', link: new URL('https://link_mock'), - sha265sum: `sha265sum_mock${id}`, + sha256sum: `sha256sum_mock${id}`, sha256sum_link: new URL('https://sha256sum_link_mock'), signature_link: new URL('https://signature_link_mock'), }, @@ -64,7 +64,7 @@ export const createRandomMarketplaceRelease = (installer, id): MarketplaceReleas { name: 'installer_name_mock.msi', link: new URL('https://installer_link_mock'), - sha265sum: 'installer_sha265sum_mock', + sha256sum: 'installer_sha256sum_mock', sha256sum_link: new URL('https://installer_sha256sum_link_mock'), signature_link: new URL('https://installer_signature_link_mock'), }, @@ -109,7 +109,7 @@ export const mockLatestTemurin = (installer): LatestTemurin => ({ package: { name: 'name_mock.tar.gz', link: new URL('https://link_mock'), - checksum: 'sha265sum_mock', + checksum: 'sha256sum_mock', checksum_link: new URL('https://sha256sum_link_mock'), metadata_link: new URL('https://metadata_link_mock'), signature_link: new URL('https://signature_link_mock'), @@ -121,7 +121,7 @@ export const mockLatestTemurin = (installer): LatestTemurin => ({ { name: 'installer_name_mock.msi', link: new URL('https://installer_link_mock'), - checksum: 'installer_sha265sum_mock', + checksum: 'installer_sha256sum_mock', checksum_link: new URL('https://installer_sha256sum_link_mock'), metadata_link: new URL('https://installer_metadata_link_mock'), signature_link: new URL('https://installer_signature_link_mock'), diff --git a/src/components/MarketplaceDownloadTable/__tests__/MarketplaceDownloadTable.test.tsx b/src/components/MarketplaceDownloadTable/__tests__/MarketplaceDownloadTable.test.tsx index 53fac7592..9ac3c7026 100644 --- a/src/components/MarketplaceDownloadTable/__tests__/MarketplaceDownloadTable.test.tsx +++ b/src/components/MarketplaceDownloadTable/__tests__/MarketplaceDownloadTable.test.tsx @@ -60,6 +60,10 @@ describe('MarketplaceDownloadTable component', () => { ]; // erase checksum + releases[0].binary.package.sha256sum = undefined; + releases[0].binary.installer[0].sha256sum = undefined; + + // Name of previous typo to be removed when vendors update their code to fix the typo releases[0].binary.package.sha265sum = undefined; releases[0].binary.installer[0].sha265sum = undefined; @@ -71,4 +75,4 @@ describe('MarketplaceDownloadTable component', () => { expect(container).toMatchSnapshot(); }); -}); \ No newline at end of file +}); diff --git a/src/components/MarketplaceDownloadTable/__tests__/__snapshots__/MarketplaceDownloadTable.test.tsx.snap b/src/components/MarketplaceDownloadTable/__tests__/__snapshots__/MarketplaceDownloadTable.test.tsx.snap index b6910d3de..09500f970 100644 --- a/src/components/MarketplaceDownloadTable/__tests__/__snapshots__/MarketplaceDownloadTable.test.tsx.snap +++ b/src/components/MarketplaceDownloadTable/__tests__/__snapshots__/MarketplaceDownloadTable.test.tsx.snap @@ -122,14 +122,14 @@ exports[`MarketplaceDownloadTable component > renders correctly - Without checks class="align-middle" >
@@ -142,7 +142,7 @@ exports[`MarketplaceDownloadTable component > renders correctly - Without checks
renders correctly - Without checks
@@ -183,7 +183,7 @@ exports[`MarketplaceDownloadTable component > renders correctly - Without checks
renders correctly 1`] = ` class="align-middle" >
renders correctly 1`] = `
renders correctly 1`] = ` class="align-middle" >
renders correctly 1`] = `
renders correctly 1`] = `
renders correctly 1`] = `
{ {pkg.binary.architecture} - +
{pkg.binary.installer && ( { /> )} { return ( - -
+
@@ -120,7 +120,7 @@ const BinaryTable = ({ checksum, link, filename, os, arch, pkgType, javaVersion,
+ {fetchExtension(filename)} diff --git a/src/components/TemurinDownloadTable/__tests__/__snapshots__/TemurinDownloadTable.test.tsx.snap b/src/components/TemurinDownloadTable/__tests__/__snapshots__/TemurinDownloadTable.test.tsx.snap index c8dee94fe..de4d82503 100644 --- a/src/components/TemurinDownloadTable/__tests__/__snapshots__/TemurinDownloadTable.test.tsx.snap +++ b/src/components/TemurinDownloadTable/__tests__/__snapshots__/TemurinDownloadTable.test.tsx.snap @@ -85,14 +85,14 @@ exports[`TemurinDownloadTable component > renders correctly - Without checksum 1 class="align-middle" >
@@ -123,7 +123,7 @@ exports[`TemurinDownloadTable component > renders correctly - Without checksum 1
renders correctly - Without checksum 1
@@ -173,7 +173,7 @@ exports[`TemurinDownloadTable component > renders correctly - Without checksum 1
renders correctly - with source 1`] = class="align-middle" >
@@ -411,7 +411,7 @@ exports[`TemurinDownloadTable component > renders correctly - with source 1`] =
renders correctly - with source 1`] = class="align-middle" >
@@ -554,7 +554,7 @@ exports[`TemurinDownloadTable component > renders correctly - with source 1`] =
renders correctly - with source 1`] =
@@ -613,7 +613,7 @@ exports[`TemurinDownloadTable component > renders correctly - with source 1`] =
renders correctly 1`] = ` class="align-middle" >
@@ -771,7 +771,7 @@ exports[`TemurinDownloadTable component > renders correctly 1`] = `
renders correctly 1`] = ` class="align-middle" >
@@ -914,7 +914,7 @@ exports[`TemurinDownloadTable component > renders correctly 1`] = `
renders correctly 1`] = `
@@ -973,7 +973,7 @@ exports[`TemurinDownloadTable component > renders correctly 1`] = `
{ {capitalize(pkg.os)} {pkg.architecture === 'x32' ? 'x86' : pkg.architecture} - +
{pkg.binaries.map( (binary, i): string | JSX.Element => binary && ( @@ -105,7 +105,7 @@ export default TemurinDownloadTable; const BinaryTable = ({ checksum, link, extension, type, size, os, arch, version }) => { return ( - -
+
@@ -125,7 +125,7 @@ const BinaryTable = ({ checksum, link, extension, type, size, os, arch, version
+ {extension} diff --git a/src/hooks/__tests__/__snapshots__/fetchLatestTemurin.test.tsx.snap b/src/hooks/__tests__/__snapshots__/fetchLatestTemurin.test.tsx.snap index 97b4427b1..d8744cd00 100644 --- a/src/hooks/__tests__/__snapshots__/fetchLatestTemurin.test.tsx.snap +++ b/src/hooks/__tests__/__snapshots__/fetchLatestTemurin.test.tsx.snap @@ -2,7 +2,7 @@ exports[`fetchLatestForOS > binary URL is set correctly 1`] = ` { - "checksum": "sha265sum_mock", + "checksum": "sha256sum_mock", "link": "https://link_mock/", "release_name": "release_name_mock", } @@ -10,7 +10,7 @@ exports[`fetchLatestForOS > binary URL is set correctly 1`] = ` exports[`fetchLatestForOS > installer is returned if available 1`] = ` { - "checksum": "installer_sha265sum_mock", + "checksum": "installer_sha256sum_mock", "link": "https://installer_link_mock/", "release_name": "release_name_mock", } diff --git a/src/hooks/fetchMarketplace.tsx b/src/hooks/fetchMarketplace.tsx index 2d211fd1a..ba6a78185 100644 --- a/src/hooks/fetchMarketplace.tsx +++ b/src/hooks/fetchMarketplace.tsx @@ -69,14 +69,18 @@ export interface MarketplaceRelease { package: { name: string; link: URL; + // Name of previous typo to be removed when vendors update their code to fix the typo sha265sum: string; + sha256sum: string; sha256sum_link: URL; signature_link: URL; } installer?: [{ name: string; link: URL; + // Name of previous typo to be removed when vendors update their code to fix the typo sha265sum: string; + sha256sum: string; sha256sum_link: URL; signature_link: URL; }] diff --git a/src/pages/__tests__/__snapshots__/download.test.tsx.snap b/src/pages/__tests__/__snapshots__/download.test.tsx.snap index c0069364a..1ebd65da7 100644 --- a/src/pages/__tests__/__snapshots__/download.test.tsx.snap +++ b/src/pages/__tests__/__snapshots__/download.test.tsx.snap @@ -46,7 +46,7 @@ exports[`Download page > renders correctly - vendor 1`] = ` > renders correctly 1`] = ` > { const location = { state: { link: 'https://fake-download.tar.gz', - checksum: 'sha265sum_mock', + checksum: 'sha256sum_mock', os: 'linux', arch: 'x64', java_version: '1.0.0',