plugins/graphiql: fix page test

This commit is contained in:
Patrik Oldsberg
2020-04-23 17:54:58 +02:00
parent 7ec8e0d0c2
commit c8ef790e1b
@@ -17,18 +17,21 @@
import React from 'react';
import { render } from '@testing-library/react';
import mockFetch from 'jest-fetch-mock';
import ExampleComponent from './ExampleComponent';
import { GraphiQLPage } from './GraphiQLPage';
import { ThemeProvider } from '@material-ui/core';
import { lightTheme } from '@backstage/theme';
describe('ExampleComponent', () => {
jest.mock('graphiql', () => () => '<GraphiQL />');
describe('GraphiQLPage', () => {
it('should render', () => {
mockFetch.mockResponse(() => new Promise(() => {}));
const rendered = render(
<ThemeProvider theme={lightTheme}>
<ExampleComponent />
<GraphiQLPage />
</ThemeProvider>,
);
expect(rendered.getByText('Welcome to graphiql!')).toBeInTheDocument();
expect(rendered.getByText('GraphiQL')).toBeInTheDocument();
expect(rendered.getByText('<GraphiQL />')).toBeInTheDocument();
});
});