Answer the question
In order to leave comments, you need to log in
Is testing done correctly?
Hello. I'm covering an application with tests and I need to test a component that is wrapped in a redux connect hook. Is the following code implemented correctly:
import React from 'react';
import { Provider } from 'react-redux';
import { shallow } from 'enzyme';
import FilmPage from '../../pages/FilmPage';
import store from '../../store/Store';
describe('film page', () => {
it('correct film title display', () => {
let filmPage = shallow(
<Provider store={store}>
<FilmPage />
</Provider>
);
expect(filmPage.find('div')).toHaveLength(0);
})
})
Answer the question
In order to leave comments, you need to log in
As an option
import { createHashHistory } from 'history'
import { createStore } from 'redux'
import reducer from 'reducer'
import { Provider } from 'react-redux'
import { store } from 'store'
const history = createHashHistory()
const store = createStore(reducer(history))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question