Write tests for custom Wizard and List pages

Signed-off-by: Min Kim <minkimcello@gmail.com>
Co-authored-by: Taras Mankovski <taras@frontside.com>
This commit is contained in:
Min Kim
2023-03-16 11:46:42 -04:00
parent 001a6e61b4
commit 2e2cbb5a78
@@ -47,6 +47,21 @@ describe('Router', () => {
expect(TemplateListPage).toHaveBeenCalled();
});
it('should render user-provided TemplateListPage', async () => {
const { getByText } = await renderInTestApp(
<Router
components={{
TemplateListPageComponent: () => <>foobar</>,
}}
/>,
{
routeEntries: ['/'],
},
);
expect(getByText('foobar')).toBeInTheDocument();
expect(TemplateListPage).not.toHaveBeenCalled();
});
});
describe('/templates/:templateName', () => {
@@ -58,6 +73,21 @@ describe('Router', () => {
expect(TemplateWizardPage).toHaveBeenCalled();
});
it('should render user-provided TemplateWizardPage', async () => {
const { getByText } = await renderInTestApp(
<Router
components={{
TemplateWizardPageComponent: () => <>foobar</>,
}}
/>,
{
routeEntries: ['/templates/default/foo'],
},
);
expect(getByText('foobar')).toBeInTheDocument();
expect(TemplateWizardPage).not.toHaveBeenCalled();
});
it('should pass through the FormProps property', async () => {
const transformErrorsMock = jest.fn();