From 2e2cbb5a788458ac2aef934fa91bf146d5c11306 Mon Sep 17 00:00:00 2001 From: Min Kim Date: Thu, 16 Mar 2023 11:46:42 -0400 Subject: [PATCH] Write tests for custom Wizard and List pages Signed-off-by: Min Kim Co-authored-by: Taras Mankovski --- .../src/next/Router/Router.test.tsx | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/plugins/scaffolder/src/next/Router/Router.test.tsx b/plugins/scaffolder/src/next/Router/Router.test.tsx index 9565572a2f..3d52dd0dd0 100644 --- a/plugins/scaffolder/src/next/Router/Router.test.tsx +++ b/plugins/scaffolder/src/next/Router/Router.test.tsx @@ -47,6 +47,21 @@ describe('Router', () => { expect(TemplateListPage).toHaveBeenCalled(); }); + + it('should render user-provided TemplateListPage', async () => { + const { getByText } = await renderInTestApp( + <>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( + <>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();