From 57ad6553d04bca7963100f972ed625a32dfe0a90 Mon Sep 17 00:00:00 2001 From: Paul Cowan Date: Fri, 16 Dec 2022 18:40:10 +0000 Subject: [PATCH] pass through transformErrors to TemplateWizardPage Signed-off-by: Paul Cowan --- .changeset/perfect-garlics-care.md | 5 +++++ plugins/scaffolder/src/next/Router/Router.test.tsx | 14 ++++++++++++++ plugins/scaffolder/src/next/Router/Router.tsx | 5 ++++- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 .changeset/perfect-garlics-care.md diff --git a/.changeset/perfect-garlics-care.md b/.changeset/perfect-garlics-care.md new file mode 100644 index 0000000000..e6f56e6d69 --- /dev/null +++ b/.changeset/perfect-garlics-care.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder': patch +--- + +Pass through transformErrors to TemplateWizardPage diff --git a/plugins/scaffolder/src/next/Router/Router.test.tsx b/plugins/scaffolder/src/next/Router/Router.test.tsx index 1aaca1a94b..78e21f57fd 100644 --- a/plugins/scaffolder/src/next/Router/Router.test.tsx +++ b/plugins/scaffolder/src/next/Router/Router.test.tsx @@ -54,6 +54,20 @@ describe('Router', () => { expect(TemplateWizardPage).toHaveBeenCalled(); }); + it('should pass through the transformErrors property', async () => { + const transformErrorsMock = jest.fn(); + + await renderInTestApp(, { + routeEntries: ['/templates/default/foo'], + }); + + const mock = TemplateWizardPage as jest.Mock; + + const [{ transformErrors }] = mock.mock.calls[0]; + + expect(transformErrors).toEqual(transformErrors); + }); + it('should extract the fieldExtensions and pass them through', async () => { const mockComponent = () => null; const CustomFieldExtension = scaffolderPlugin.provide( diff --git a/plugins/scaffolder/src/next/Router/Router.tsx b/plugins/scaffolder/src/next/Router/Router.tsx index 9ca1e39681..ecf89c8742 100644 --- a/plugins/scaffolder/src/next/Router/Router.tsx +++ b/plugins/scaffolder/src/next/Router/Router.tsx @@ -93,7 +93,10 @@ export const Router = (props: PropsWithChildren) => { path={nextSelectedTemplateRouteRef.path} element={ - + } />