From 2a448f0f28f2b3718c0046523eeb815f3c23f39f Mon Sep 17 00:00:00 2001 From: Xavier FACQ Date: Wed, 20 Nov 2024 14:46:56 +0100 Subject: [PATCH 1/5] [issue-3221] Pb when checksum is not available --- src/components/MarketplaceDownloadTable/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/MarketplaceDownloadTable/index.tsx b/src/components/MarketplaceDownloadTable/index.tsx index 22496b622..33ea18883 100644 --- a/src/components/MarketplaceDownloadTable/index.tsx +++ b/src/components/MarketplaceDownloadTable/index.tsx @@ -112,7 +112,10 @@ const BinaryTable = ({ checksum, link, filename, os, arch, pkgType, javaVersion,
- Checksum (SHA256) + {checksum + ? Checksum (SHA256) + : No Checksum + }
From 64dae30d15edb6e3cf74592dc4310135aad352cc Mon Sep 17 00:00:00 2001 From: Xavier FACQ Date: Wed, 20 Nov 2024 15:10:29 +0100 Subject: [PATCH 2/5] Change all calls --- src/components/MarketplaceDownloadTable/index.tsx | 2 +- src/components/TemurinArchiveTable/index.tsx | 11 +++++++---- src/components/TemurinDownloadTable/index.tsx | 10 ++++------ src/components/TemurinNightlyTable/index.tsx | 7 ++++++- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/components/MarketplaceDownloadTable/index.tsx b/src/components/MarketplaceDownloadTable/index.tsx index 33ea18883..5418126ba 100644 --- a/src/components/MarketplaceDownloadTable/index.tsx +++ b/src/components/MarketplaceDownloadTable/index.tsx @@ -114,7 +114,7 @@ const BinaryTable = ({ checksum, link, filename, os, arch, pkgType, javaVersion, {checksum ? Checksum (SHA256) - : No Checksum + : <> } diff --git a/src/components/TemurinArchiveTable/index.tsx b/src/components/TemurinArchiveTable/index.tsx index 8c779f83d..489942886 100644 --- a/src/components/TemurinArchiveTable/index.tsx +++ b/src/components/TemurinArchiveTable/index.tsx @@ -88,9 +88,9 @@ const TemurinArchiveTable = ({results, updatePage}) => { } - {asset.installer_link ? ( - Checksum - ): <> + {asset.installer_link && asset.installer_checksum + ? Checksum + : <> } @@ -105,7 +105,10 @@ const TemurinArchiveTable = ({results, updatePage}) => { /> - Checksum + {asset.checksum + ? Checksum + : <> + } ) diff --git a/src/components/TemurinDownloadTable/index.tsx b/src/components/TemurinDownloadTable/index.tsx index 55a06747e..de86f1c88 100644 --- a/src/components/TemurinDownloadTable/index.tsx +++ b/src/components/TemurinDownloadTable/index.tsx @@ -115,12 +115,10 @@ const BinaryTable = ({ checksum, link, extension, type, size, os, arch, version - - Checksum - + {checksum + ? Checksum + : <> + } diff --git a/src/components/TemurinNightlyTable/index.tsx b/src/components/TemurinNightlyTable/index.tsx index 6674036a4..a441643fc 100644 --- a/src/components/TemurinNightlyTable/index.tsx +++ b/src/components/TemurinNightlyTable/index.tsx @@ -47,7 +47,12 @@ const TemurinNightlyTable = ({results}) => { ) : } - Checksum + + {asset.checksum + ? Checksum + : <> + } + ) ) From b4ff4707935b2bcfd03461a903909abccd13bcde Mon Sep 17 00:00:00 2001 From: Xavier FACQ Date: Wed, 20 Nov 2024 16:05:22 +0100 Subject: [PATCH 3/5] Improve codecov --- .../MarketplaceDownloadTable.test.tsx | 20 +- .../MarketplaceDownloadTable.test.tsx.snap | 214 ++++++++++++ .../__tests__/TemurinArchiveTable.test.tsx | 20 ++ .../TemurinArchiveTable.test.tsx.snap | 317 ++++++++++++++++++ .../__tests__/TemurinDownloadTable.test.tsx | 16 + .../TemurinDownloadTable.test.tsx.snap | 206 ++++++++++++ .../__tests__/TemurinNightlyTable.test.tsx | 19 ++ .../TemurinNightlyTable.test.tsx.snap | 96 ++++++ 8 files changed, 907 insertions(+), 1 deletion(-) diff --git a/src/components/MarketplaceDownloadTable/__tests__/MarketplaceDownloadTable.test.tsx b/src/components/MarketplaceDownloadTable/__tests__/MarketplaceDownloadTable.test.tsx index ff215af24..402dc7fc0 100644 --- a/src/components/MarketplaceDownloadTable/__tests__/MarketplaceDownloadTable.test.tsx +++ b/src/components/MarketplaceDownloadTable/__tests__/MarketplaceDownloadTable.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { render } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; import { describe, expect, it } from 'vitest' import { createRandomMarketplaceRelease } from '../../../__fixtures__/hooks'; import MarketplaceDownloadTable from '..'; @@ -53,4 +53,22 @@ describe('MarketplaceDownloadTable component', () => { ); expect(queryByText('Out of Date')).not.toBeInTheDocument(); }); + + it('renders correctly - Without checksum', () => { + let releases = [ + createRandomMarketplaceRelease(true, 1), + ]; + + // erase checksum + releases[0].binary.package.sha265sum = undefined; + releases[0].binary.installer[0].sha265sum = undefined; + + const { container } = render( + + ); + + 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 57023bfea..ad4e479ca 100644 --- a/src/components/MarketplaceDownloadTable/__tests__/__snapshots__/MarketplaceDownloadTable.test.tsx.snap +++ b/src/components/MarketplaceDownloadTable/__tests__/__snapshots__/MarketplaceDownloadTable.test.tsx.snap @@ -1,5 +1,219 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`MarketplaceDownloadTable component > renders correctly - Without checksum 1`] = ` +
+ + + + + + + + + + + + + + + + + + + + + +
+ Text + + Text + + Text + + Text + + Text + + Text +
+ + release_name_mock + +
+ + JRE + +
+ + January 1, 2020 + + + +
+ + + This build is over 180 days old. + + + + Out of Date +
+
+
+ Distribution_mock + + distribution_mock logo + + Os_mock + + arch_mock + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + + + .msi + +
+ + + + + +
+
+
+ + + + + + .tar.gz + +
+
+
+`; + exports[`MarketplaceDownloadTable component > renders correctly - no data 1`] = `
{ ); expect(container).toMatchSnapshot(); }); + + it('renders correctly - Without checksum', () => { + let data = { + pagecount: 1, + releases : [ + createRandomTemurinReleases(true), + ] + }; + + // erase checksum + data.releases[0].platforms.platform_mock.assets[0].checksum = undefined; + + const { container } = render( + + ); + expect(container).toMatchSnapshot(); + }); }); \ No newline at end of file diff --git a/src/components/TemurinArchiveTable/__tests__/__snapshots__/TemurinArchiveTable.test.tsx.snap b/src/components/TemurinArchiveTable/__tests__/__snapshots__/TemurinArchiveTable.test.tsx.snap index 41407157d..c1359ba69 100644 --- a/src/components/TemurinArchiveTable/__tests__/__snapshots__/TemurinArchiveTable.test.tsx.snap +++ b/src/components/TemurinArchiveTable/__tests__/__snapshots__/TemurinArchiveTable.test.tsx.snap @@ -1,5 +1,322 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`TemurinArchiveTable component > renders correctly - Without checksum 1`] = ` +
+
+
+ + + + + + +
+
+ +

+ release_name_mock +

+
+ + + This build is JCK certified + + + + + + AQAvit logo + +

+ January 1, 2020 +

+

+ + + + + + Text + +

+

+ + + + + + + Text + +

+
+
+ + + + + + + + + + + + + + + + +
+ OS / Architecture + + Installer + + SHA256 + + Binary + + SHA256 +
+ Os_mock architecture_mock + + + type_mock + + + + + Text + + + + type_mock + + 0 MB + + +
+
+ +
+ +`; + exports[`TemurinArchiveTable component > renders correctly - no data 1`] = `
{ ); expect(container).toMatchSnapshot(); }); + + it('renders correctly - Without checksum', () => { + let releases = [ + createRandomTemurinRelease(true), + ]; + + // erase checksum + releases[0].binaries[0].checksum = undefined; + + const { container } = render( + + ); + expect(container).toMatchSnapshot(); + }); }); \ No newline at end of file diff --git a/src/components/TemurinDownloadTable/__tests__/__snapshots__/TemurinDownloadTable.test.tsx.snap b/src/components/TemurinDownloadTable/__tests__/__snapshots__/TemurinDownloadTable.test.tsx.snap index ce28c1b05..85addad14 100644 --- a/src/components/TemurinDownloadTable/__tests__/__snapshots__/TemurinDownloadTable.test.tsx.snap +++ b/src/components/TemurinDownloadTable/__tests__/__snapshots__/TemurinDownloadTable.test.tsx.snap @@ -1,5 +1,211 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`TemurinDownloadTable component > renders correctly - Without checksum 1`] = ` +
+ + + + + + + + + +
+ + + release_name_mock + + + + Temurin + + + This build is JCK certified + + + + + + AQAvit logo + + + + January 1, 2020 + + + Os_mock + + arch_mock + + + + + + + + + + + + +
+ + + + + + + + + +
+ type_mock - 0 MB +
+ + + + Text + + + +
+
+ + + + + + installer_extension_mock + +
+ + + + + + + + + +
+ type_mock - 0 MB +
+ +
+
+ + + + + + extension_mock + +
+
+
+`; + exports[`TemurinDownloadTable component > renders correctly - no data 1`] = `
{ ); expect(container).toMatchSnapshot(); }); + + it('renders correctly - Without checksum', () => { + const data = { + pagecount: null, + releases: [ + createRandomTemurinReleases(true), + ] + } + + // erase checksum + data.releases[0].platforms.platform_mock.assets[0].checksum = undefined; + + const { container } = render( + + ); + expect(container).toMatchSnapshot(); + }); }); \ No newline at end of file diff --git a/src/components/TemurinNightlyTable/__tests__/__snapshots__/TemurinNightlyTable.test.tsx.snap b/src/components/TemurinNightlyTable/__tests__/__snapshots__/TemurinNightlyTable.test.tsx.snap index 8427148cd..3b8f075c9 100644 --- a/src/components/TemurinNightlyTable/__tests__/__snapshots__/TemurinNightlyTable.test.tsx.snap +++ b/src/components/TemurinNightlyTable/__tests__/__snapshots__/TemurinNightlyTable.test.tsx.snap @@ -1,5 +1,101 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`TemurinNightlyTable component > renders correctly - Without checksum 1`] = ` +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Platform + + Type + + Build/Tag + + Date + + Binary + + Installer + + SHA256 +
+ Os_mock + + architecture_mock + + type_mock + + release_name_mock + + January 1, 2020 + + + extension_mock (0 MB) + + + + installer_extension_mock + + +
+
+
+`; + exports[`TemurinNightlyTable component > renders correctly - no data 1`] = `
Date: Wed, 20 Nov 2024 16:11:26 +0100 Subject: [PATCH 4/5] Set text = Not available --- .../__snapshots__/MarketplaceDownloadTable.test.tsx.snap | 8 ++++++-- src/components/MarketplaceDownloadTable/index.tsx | 2 +- .../__snapshots__/TemurinArchiveTable.test.tsx.snap | 8 ++++++-- src/components/TemurinArchiveTable/index.tsx | 4 ++-- .../__snapshots__/TemurinDownloadTable.test.tsx.snap | 4 +++- src/components/TemurinDownloadTable/index.tsx | 2 +- .../__snapshots__/TemurinNightlyTable.test.tsx.snap | 4 +++- src/components/TemurinNightlyTable/index.tsx | 2 +- 8 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/components/MarketplaceDownloadTable/__tests__/__snapshots__/MarketplaceDownloadTable.test.tsx.snap b/src/components/MarketplaceDownloadTable/__tests__/__snapshots__/MarketplaceDownloadTable.test.tsx.snap index ad4e479ca..b6910d3de 100644 --- a/src/components/MarketplaceDownloadTable/__tests__/__snapshots__/MarketplaceDownloadTable.test.tsx.snap +++ b/src/components/MarketplaceDownloadTable/__tests__/__snapshots__/MarketplaceDownloadTable.test.tsx.snap @@ -134,7 +134,9 @@ exports[`MarketplaceDownloadTable component > renders correctly - Without checks -
+ + Text +
@@ -173,7 +175,9 @@ exports[`MarketplaceDownloadTable component > renders correctly - Without checks -
+ + Text +
diff --git a/src/components/MarketplaceDownloadTable/index.tsx b/src/components/MarketplaceDownloadTable/index.tsx index 5418126ba..fb43b83c9 100644 --- a/src/components/MarketplaceDownloadTable/index.tsx +++ b/src/components/MarketplaceDownloadTable/index.tsx @@ -114,7 +114,7 @@ const BinaryTable = ({ checksum, link, filename, os, arch, pkgType, javaVersion, {checksum ? Checksum (SHA256) - : <> + : Not available } diff --git a/src/components/TemurinArchiveTable/__tests__/__snapshots__/TemurinArchiveTable.test.tsx.snap b/src/components/TemurinArchiveTable/__tests__/__snapshots__/TemurinArchiveTable.test.tsx.snap index c1359ba69..7f75eed12 100644 --- a/src/components/TemurinArchiveTable/__tests__/__snapshots__/TemurinArchiveTable.test.tsx.snap +++ b/src/components/TemurinArchiveTable/__tests__/__snapshots__/TemurinArchiveTable.test.tsx.snap @@ -201,7 +201,9 @@ exports[`TemurinArchiveTable component > renders correctly - Without checksum 1` 0 MB - + + Text + @@ -511,7 +513,9 @@ exports[`TemurinArchiveTable component > renders correctly 1`] = ` + > + Text + diff --git a/src/components/TemurinArchiveTable/index.tsx b/src/components/TemurinArchiveTable/index.tsx index 489942886..11b340df8 100644 --- a/src/components/TemurinArchiveTable/index.tsx +++ b/src/components/TemurinArchiveTable/index.tsx @@ -90,7 +90,7 @@ const TemurinArchiveTable = ({results, updatePage}) => { {asset.installer_link && asset.installer_checksum ? Checksum - : <> + : Not available } @@ -107,7 +107,7 @@ const TemurinArchiveTable = ({results, updatePage}) => { {asset.checksum ? Checksum - : <> + : Not available } diff --git a/src/components/TemurinDownloadTable/__tests__/__snapshots__/TemurinDownloadTable.test.tsx.snap b/src/components/TemurinDownloadTable/__tests__/__snapshots__/TemurinDownloadTable.test.tsx.snap index 85addad14..c8dee94fe 100644 --- a/src/components/TemurinDownloadTable/__tests__/__snapshots__/TemurinDownloadTable.test.tsx.snap +++ b/src/components/TemurinDownloadTable/__tests__/__snapshots__/TemurinDownloadTable.test.tsx.snap @@ -164,7 +164,9 @@ exports[`TemurinDownloadTable component > renders correctly - Without checksum 1 + > + Text + diff --git a/src/components/TemurinDownloadTable/index.tsx b/src/components/TemurinDownloadTable/index.tsx index de86f1c88..44a4dc51e 100644 --- a/src/components/TemurinDownloadTable/index.tsx +++ b/src/components/TemurinDownloadTable/index.tsx @@ -117,7 +117,7 @@ const BinaryTable = ({ checksum, link, extension, type, size, os, arch, version {checksum ? Checksum - : <> + : Not available } diff --git a/src/components/TemurinNightlyTable/__tests__/__snapshots__/TemurinNightlyTable.test.tsx.snap b/src/components/TemurinNightlyTable/__tests__/__snapshots__/TemurinNightlyTable.test.tsx.snap index 3b8f075c9..995f519fe 100644 --- a/src/components/TemurinNightlyTable/__tests__/__snapshots__/TemurinNightlyTable.test.tsx.snap +++ b/src/components/TemurinNightlyTable/__tests__/__snapshots__/TemurinNightlyTable.test.tsx.snap @@ -88,7 +88,9 @@ exports[`TemurinNightlyTable component > renders correctly - Without checksum 1` installer_extension_mock - + + Text + diff --git a/src/components/TemurinNightlyTable/index.tsx b/src/components/TemurinNightlyTable/index.tsx index a441643fc..7710531f6 100644 --- a/src/components/TemurinNightlyTable/index.tsx +++ b/src/components/TemurinNightlyTable/index.tsx @@ -50,7 +50,7 @@ const TemurinNightlyTable = ({results}) => { {asset.checksum ? Checksum - : <> + : Not available } From a7d5dcb452f506fb3384ee15e135b31f4eb2fa99 Mon Sep 17 00:00:00 2001 From: Xavier FACQ Date: Wed, 20 Nov 2024 17:19:29 +0100 Subject: [PATCH 5/5] Remove unused import --- .../__tests__/MarketplaceDownloadTable.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/MarketplaceDownloadTable/__tests__/MarketplaceDownloadTable.test.tsx b/src/components/MarketplaceDownloadTable/__tests__/MarketplaceDownloadTable.test.tsx index 402dc7fc0..53fac7592 100644 --- a/src/components/MarketplaceDownloadTable/__tests__/MarketplaceDownloadTable.test.tsx +++ b/src/components/MarketplaceDownloadTable/__tests__/MarketplaceDownloadTable.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { render, screen } from '@testing-library/react'; +import { render } from '@testing-library/react'; import { describe, expect, it } from 'vitest' import { createRandomMarketplaceRelease } from '../../../__fixtures__/hooks'; import MarketplaceDownloadTable from '..';