diff --git a/src/__tests__/Explore/Explore.test.js b/src/__tests__/Explore/Explore.test.js index 6311f314..46e157e3 100644 --- a/src/__tests__/Explore/Explore.test.js +++ b/src/__tests__/Explore/Explore.test.js @@ -30,6 +30,7 @@ const mockImageList = { NewestImage: { Tag: 'latest', Description: 'w', + IsSigned: true, Licenses: '', Vendor: '', Labels: '' @@ -42,6 +43,7 @@ const mockImageList = { NewestImage: { Tag: 'latest', Description: '', + IsSigned: false, Licenses: '', Vendor: '', Labels: '' @@ -54,6 +56,7 @@ const mockImageList = { NewestImage: { Tag: 'latest', Description: '', + IsSigned: false, Licenses: '', Vendor: '', Labels: '' @@ -84,6 +87,14 @@ describe('Explore component', () => { expect(await screen.findByText(/Looks like/i)).toBeInTheDocument(); }); + it('renders signature chips', async () => { + // @ts-ignore + jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockImageList } }); + render(); + expect(await screen.findAllByTestId('unverified-chip')).toHaveLength(2); + expect(await screen.findAllByTestId('verified-chip')).toHaveLength(1); + }); + it("should log an error when data can't be fetched", async () => { // @ts-ignore jest.spyOn(api, 'get').mockRejectedValue({ status: 500, data: {} }); diff --git a/src/api.js b/src/api.js index 4f9f6bb6..e21bc0b6 100644 --- a/src/api.js +++ b/src/api.js @@ -85,7 +85,7 @@ const endpoints = { if (filter.HasToBeSigned) filterParam += ` HasToBeSigned: ${filter.HasToBeSigned}`; filterParam += '}'; if (Object.keys(filter).length === 0) filterParam = ''; - return `/v2/_zot/ext/search?query={GlobalSearch(${searchParam}, ${paginationParam} ${filterParam}) {Repos {Name LastUpdated Size Platforms { Os Arch } NewestImage { Tag Description Licenses Vendor Labels } DownloadCount}}}`; + return `/v2/_zot/ext/search?query={GlobalSearch(${searchParam}, ${paginationParam} ${filterParam}) {Repos {Name LastUpdated Size Platforms { Os Arch } NewestImage { Tag Description IsSigned Licenses Vendor Labels } DownloadCount}}}`; } }; diff --git a/src/components/Explore.jsx b/src/components/Explore.jsx index 57408478..c2f6ad99 100644 --- a/src/components/Explore.jsx +++ b/src/components/Explore.jsx @@ -108,6 +108,7 @@ function Explore() { name={item.name} version={item.latestVersion} description={item.description} + isSigned={item.isSigned} tags={item.tags} vendor={item.vendor} platforms={item.platforms}