Merge branch '21764-project-picker-crash' into main. Closes #21764
[arvados.git] / services / workbench2 / src / views / workbench / workbench.test.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import React from 'react';
6 import ReactDOM from 'react-dom';
7 import { WorkbenchPanel } from './workbench';
8 import { Provider } from "react-redux";
9 import { configureStore } from "store/store";
10 import { createBrowserHistory } from "history";
11 import { ConnectedRouter } from "react-router-redux";
12 import { MuiThemeProvider } from '@material-ui/core/styles';
13 import { CustomTheme } from 'common/custom-theme';
14 import { createServices } from "services/services";
15 import 'jest-localstorage-mock';
16
17 jest.mock('views-components/baner/banner', () => ({ Banner: () => 'Banner' }))
18
19 const history = createBrowserHistory();
20
21 it('renders without crashing', () => {
22     const div = document.createElement('div');
23     const services = createServices("/arvados/v1");
24         services.authService.getUuid = jest.fn().mockReturnValueOnce('test');
25     const store = configureStore(createBrowserHistory(), services);
26     ReactDOM.render(
27         <MuiThemeProvider theme={CustomTheme}>
28             <Provider store={store}>
29                 <ConnectedRouter history={history}>
30                     <WorkbenchPanel />
31                 </ConnectedRouter>
32             </Provider>
33         </MuiThemeProvider>,
34     div);
35     ReactDOM.unmountComponentAtNode(div);
36 });