Skip to content

Commit fc2d9d3

Browse files
committed
update test with store context
1 parent d182f8b commit fc2d9d3

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

test/components/root.spec.jsx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,16 @@ import chaiEnzyme from 'chai-enzyme'
55
chai.use(chaiEnzyme())
66

77
import Root from '../../src/components/root.jsx'
8+
import makeStore from '../../src/store'
89

9-
// this fails with:
10-
// Invariant Violation: Could not find "store" in either the context or props of
11-
// "Connect(Counter)". Either wrap the root component in a <Provider>, or
12-
// explicitly pass "store" as a prop to "Connect(Counter)".
10+
const store = makeStore()
11+
let output
1312

14-
const output = shallow(<Root />)
15-
16-
// FWIW, this also fails with the same error:
13+
exports['<Root />'] = {
1714

18-
// import { Provider } from 'react-redux'
19-
// import makeStore from '../../src/store'
20-
// const store = makeStore()
21-
// const output = shallow(
22-
// <Provider store={store} >
23-
// <Root />
24-
// </Provider>
25-
// )
15+
before: () => {
16+
output = shallow(<Root />, { context: { store } })
17+
},
2618

27-
exports['<Root />'] = {
2819
'is a <div>': () => expect(output).to.have.tagName('div'),
2920
}

0 commit comments

Comments
 (0)