From 11f867f5d03d8b98510ee82e39a2900e4cb3a0a9 Mon Sep 17 00:00:00 2001 From: Tyler Davis Date: Thu, 14 Nov 2024 15:49:27 +1100 Subject: [PATCH] add tests Signed-off-by: Tyler Davis --- .../CatalogTable/CatalogTable.test.tsx | 13 +++++++++++ .../CursorPaginatedCatalogTable.test.tsx | 16 ++++++++++++++ .../OffsetPaginatedCatalogTable.test.tsx | 22 +++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx b/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx index 5b7f28e26a..13ee7593b9 100644 --- a/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx +++ b/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx @@ -84,6 +84,19 @@ describe('CatalogTable component', () => { ).resolves.toBeInTheDocument(); }); + it('should a custom title and subtitle when passed in', async () => { + await renderInTestApp( + + + + + , + ); + + expect(screen.queryByText('My Title')).toBeInTheDocument(); + expect(screen.queryByText('My Subtitle')).toBeInTheDocument(); + }); + it('should display entity names when loading has finished and no error occurred', async () => { await renderInTestApp( diff --git a/plugins/catalog/src/components/CatalogTable/CursorPaginatedCatalogTable.test.tsx b/plugins/catalog/src/components/CatalogTable/CursorPaginatedCatalogTable.test.tsx index adc69794ae..b0deec9679 100644 --- a/plugins/catalog/src/components/CatalogTable/CursorPaginatedCatalogTable.test.tsx +++ b/plugins/catalog/src/components/CatalogTable/CursorPaginatedCatalogTable.test.tsx @@ -63,6 +63,22 @@ describe('CursorPaginatedCatalogTable', () => { ); }; + it('should display the title and subtitle when passed in', async () => { + await renderInTestApp( + wrapInContext( + , + ), + ); + + expect(screen.queryByText('My Title')).toBeInTheDocument(); + expect(screen.queryByText('My Subtitle')).toBeInTheDocument(); + }); + it('should display all the items', async () => { await renderInTestApp( wrapInContext( diff --git a/plugins/catalog/src/components/CatalogTable/OffsetPaginatedCatalogTable.test.tsx b/plugins/catalog/src/components/CatalogTable/OffsetPaginatedCatalogTable.test.tsx index aad9b7cb3d..e2e73c5af8 100644 --- a/plugins/catalog/src/components/CatalogTable/OffsetPaginatedCatalogTable.test.tsx +++ b/plugins/catalog/src/components/CatalogTable/OffsetPaginatedCatalogTable.test.tsx @@ -62,6 +62,28 @@ describe('OffsetPaginatedCatalogTable', () => { ); }; + it('should display the title and subtitle when passed in', async () => { + await renderInTestApp( + wrapInContext( + , + { + setOffset: jest.fn(), + limit: Number.MAX_SAFE_INTEGER, + offset: 0, + totalItems: data.length, + }, + ), + ); + + expect(screen.queryByText('My Title')).toBeInTheDocument(); + expect(screen.queryByText('My Subtitle')).toBeInTheDocument(); + }); + it('should display all the items', async () => { await renderInTestApp( wrapInContext(