diff --git a/plugins/airbrake/src/components/AirbrakeWidget/AirbrakeWidget.test.tsx b/plugins/airbrake/src/components/AirbrakeWidget/AirbrakeWidget.test.tsx index e9e09bd6fc..becbe6ca99 100644 --- a/plugins/airbrake/src/components/AirbrakeWidget/AirbrakeWidget.test.tsx +++ b/plugins/airbrake/src/components/AirbrakeWidget/AirbrakeWidget.test.tsx @@ -15,19 +15,13 @@ */ import React from 'react'; -import { render } from '@testing-library/react'; -import { ThemeProvider } from '@material-ui/core'; -import { lightTheme } from '@backstage/theme'; import { AirbrakeWidget } from './AirbrakeWidget'; import exampleData from './example-data.json'; +import { renderInTestApp } from '@backstage/test-utils'; describe('AirbrakeWidget', () => { it('renders all errors sent from Airbrake', async () => { - const table = await render( - - - , - ); + const table = await renderInTestApp(); expect(exampleData.groups.length).toBeGreaterThan(0); for (const group of exampleData.groups) { expect( diff --git a/plugins/airbrake/src/plugin.test.tsx b/plugins/airbrake/src/plugin.test.tsx index 2747a5da67..e02410cfe7 100644 --- a/plugins/airbrake/src/plugin.test.tsx +++ b/plugins/airbrake/src/plugin.test.tsx @@ -14,10 +14,8 @@ * limitations under the License. */ import React from 'react'; -import { AirbrakeWidget, airbrakePlugin } from './plugin'; -import { renderWithEffects } from '@backstage/test-utils'; -import { createApp } from '@backstage/app-defaults'; -import { Route } from 'react-router'; +import { airbrakePlugin, AirbrakeWidget } from './plugin'; +import { renderInTestApp } from '@backstage/test-utils'; describe('Airbrake', () => { it('should export plugin', () => { @@ -25,33 +23,7 @@ describe('Airbrake', () => { }); it('should render page', async () => { - process.env = { - NODE_ENV: 'test', - APP_CONFIG: [ - { - data: { - app: { title: 'Test' }, - backend: { baseUrl: 'http://localhost:7000' }, - techdocs: { - storageUrl: 'http://localhost:7000/api/techdocs/static/docs', - }, - }, - context: 'test', - }, - ] as any, - }; - - const app = createApp(); - const AppProvider = app.getProvider(); - const AppRouter = app.getRouter(); - - const rendered = await renderWithEffects( - - - } /> - - , - ); + const rendered = await renderInTestApp(); expect(rendered.getByText('ChunkLoadError')).toBeInTheDocument(); }); });