I am using karma, enzyme, chai as test framework for a react project. Below is the code I used in my test case. I used redux-mock to mock the store state.
const initialState = {
}
const store = mockStore(initialState)
describe('test suite', () => {
it('testcase1', () => {
const wrapper = mount(
<Provider store={store}>
<div>
</div>
</Provider>
)
expect(wrapper.find(<div>)).to.have.length(1)
})
})
When I run this test case, I got below error:
AssertionError: expected { Object (component, root, ...) } to have a length of 1 but got 0
It seems that enzyme can't find the 'div' element. Did I miss anything here? How can I let the enzyme work?