Added signatures for explore page too

Signed-off-by: Amelia-Maria Breda <ambreda@cisco.com>
This commit is contained in:
Amelia-Maria Breda 2022-10-13 12:11:36 +01:00 committed by Raul Kele
parent 5f494adb5a
commit d4f4cea810
3 changed files with 13 additions and 1 deletions

View File

@ -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(<StateExploreWrapper />);
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: {} });

View File

@ -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}}}`;
}
};

View File

@ -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}