diff --git a/plugins/scaffolder-react/src/hooks/useCustomFieldExtensions.ts b/plugins/scaffolder-react/src/hooks/useCustomFieldExtensions.ts index 7c54614dd9..d1e670330e 100644 --- a/plugins/scaffolder-react/src/hooks/useCustomFieldExtensions.ts +++ b/plugins/scaffolder-react/src/hooks/useCustomFieldExtensions.ts @@ -35,7 +35,7 @@ export const useCustomFieldExtensions = < // Get custom fields created with FormFieldBlueprint const formFieldsApi = useApi(formFieldsApiRef); const [{ result: blueprintFields }, methods] = useAsync( - formFieldsApi?.getFormFields, + formFieldsApi.getFormFields, [], ); useMountEffect(methods.execute); diff --git a/plugins/scaffolder/src/components/Router/Router.test.tsx b/plugins/scaffolder/src/components/Router/Router.test.tsx index c551f34a51..9c752ed3c1 100644 --- a/plugins/scaffolder/src/components/Router/Router.test.tsx +++ b/plugins/scaffolder/src/components/Router/Router.test.tsx @@ -37,7 +37,10 @@ jest.mock('../../alpha/components', () => ({ TemplateListPage: jest.fn(() => null), })); -const renderInApp = (element: React.ReactElement, opts?: TestAppOptions) => +const wrapInApisAndRender = ( + element: React.ReactElement, + opts?: TestAppOptions, +) => renderInTestApp( [] }]]} @@ -54,13 +57,13 @@ describe('Router', () => { }); describe('/', () => { it('should render the TemplateListPage', async () => { - await renderInApp(); + await wrapInApisAndRender(); expect(TemplateListPage).toHaveBeenCalled(); }); it('should render user-provided TemplateListPage', async () => { - const { getByText } = await renderInApp( + const { getByText } = await wrapInApisAndRender( <>foobar, @@ -77,7 +80,7 @@ describe('Router', () => { describe('/templates/:templateName', () => { it('should render the TemplateWizard page', async () => { - await renderInApp(, { + await wrapInApisAndRender(, { routeEntries: ['/templates/default/foo'], }); @@ -85,7 +88,7 @@ describe('Router', () => { }); it('should render user-provided TemplateWizardPage', async () => { - const { getByText } = await renderInApp( + const { getByText } = await wrapInApisAndRender( <>foobar, @@ -102,7 +105,7 @@ describe('Router', () => { it('should pass through the FormProps property', async () => { const transformErrorsMock = jest.fn(); - await renderInApp( + await wrapInApisAndRender( { }), ); - await renderInApp( + await wrapInApisAndRender( @@ -162,7 +165,7 @@ describe('Router', () => { }), ); - await renderInApp( + await wrapInApisAndRender(