add tests

Signed-off-by: Tyler Davis <tylerd@canva.com>
This commit is contained in:
Tyler Davis
2024-11-14 15:49:27 +11:00
committed by Camila Belo
parent 3b44e572e7
commit 11f867f5d0
3 changed files with 51 additions and 0 deletions
@@ -84,6 +84,19 @@ describe('CatalogTable component', () => {
).resolves.toBeInTheDocument();
});
it('should a custom title and subtitle when passed in', async () => {
await renderInTestApp(
<ApiProvider apis={mockApis}>
<MockEntityListContextProvider>
<CatalogTable title="My Title" subtitle="My Subtitle" />
</MockEntityListContextProvider>
</ApiProvider>,
);
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(
<ApiProvider apis={mockApis}>
@@ -63,6 +63,22 @@ describe('CursorPaginatedCatalogTable', () => {
);
};
it('should display the title and subtitle when passed in', async () => {
await renderInTestApp(
wrapInContext(
<CursorPaginatedCatalogTable
data={data}
columns={columns}
title="My Title"
subtitle="My Subtitle"
/>,
),
);
expect(screen.queryByText('My Title')).toBeInTheDocument();
expect(screen.queryByText('My Subtitle')).toBeInTheDocument();
});
it('should display all the items', async () => {
await renderInTestApp(
wrapInContext(
@@ -62,6 +62,28 @@ describe('OffsetPaginatedCatalogTable', () => {
);
};
it('should display the title and subtitle when passed in', async () => {
await renderInTestApp(
wrapInContext(
<OffsetPaginatedCatalogTable
data={data}
columns={columns}
title="My Title"
subtitle="My Subtitle"
/>,
{
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(