throw new Error('could not find react-redux context value; please ensure the component is wrapped in a <Provider>'); code example
Example: jest Invariant Violation: could not find react-redux context value; please ensure the component is wrapped in a
import React from 'react'
import { render } from 'react-testing-library'
import App from '../pages/index.js'
import { Provider } from 'react-redux'
import configureStore from 'redux-mock-store'
describe('With React Testing Library', () => {
const initialState = {output:10}
const mockStore = configureStore()
let store,wrapper
it('Shows "Hello world!"', () => {
store = mockStore(initialState)
const { getByText } = render(<Provider store={store}><App /></Provider>)
expect(getByText('Hello Worldd!')).not.toBeNull()
})
})