frontend/smart-hut/src/App.test.js

20 lines
529 B
JavaScript
Raw Normal View History

2020-05-12 13:18:33 +00:00
import React from 'react';
import { render } from '@testing-library/react';
import { Router } from 'react-router';
import { createMemoryHistory } from 'history';
import { Provider } from 'react-redux';
import App from './App';
import smartHutStore from './store';
2020-02-24 14:22:19 +00:00
2020-05-12 13:18:33 +00:00
test('redirects to homepage', () => {
2020-03-07 10:59:04 +00:00
const history = createMemoryHistory();
render(
<Router history={history}>
2020-04-12 15:49:29 +00:00
<Provider store={smartHutStore}>
<App />
</Provider>
2020-05-12 13:18:33 +00:00
</Router>,
2020-03-07 10:59:04 +00:00
);
2020-05-12 13:18:33 +00:00
expect(history.location.pathname).toBe('/');
2020-02-24 14:22:19 +00:00
});