pass through transformErrors to TemplateWizardPage

Signed-off-by: Paul Cowan <paul.cowan@cutting.scot>
This commit is contained in:
Paul Cowan
2022-12-16 18:40:10 +00:00
parent 4c55edc7fc
commit 57ad6553d0
3 changed files with 23 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder': patch
---
Pass through transformErrors to TemplateWizardPage
@@ -54,6 +54,20 @@ describe('Router', () => {
expect(TemplateWizardPage).toHaveBeenCalled();
});
it('should pass through the transformErrors property', async () => {
const transformErrorsMock = jest.fn();
await renderInTestApp(<Router transformErrors={transformErrorsMock} />, {
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(
@@ -93,7 +93,10 @@ export const Router = (props: PropsWithChildren<NextRouterProps>) => {
path={nextSelectedTemplateRouteRef.path}
element={
<SecretsContextProvider>
<TemplateWizardPage customFieldExtensions={fieldExtensions} />
<TemplateWizardPage
customFieldExtensions={fieldExtensions}
transformErrors={props.transformErrors}
/>
</SecretsContextProvider>
}
/>