Testing-React-Redux-with-Jest-and-Enzyme icon indicating copy to clipboard operation
Testing-React-Redux-with-Jest-and-Enzyme copied to clipboard

Test fail for App.test.js

Open Meesam opened this issue 6 years ago • 0 comments

I take a clone and run the test cases . All test cases and pass except for App.test.js. its throw an error

● App Component › exampleMethod_returnsAValue Method should return value as expected

Invariant Violation: ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `object`.

   ```

const setUp = (initialState={}) => { const store = testStore(initialState); const wrapper = shallow(<App store={store} />).childAt(0).dive(); ^ return wrapper; };

      

      at invariant (node_modules/react-test-renderer/cjs/react-test-renderer-shallow.development.js:54:15)
      at ReactShallowRenderer.render (node_modules/react-test-renderer/cjs/react-test-renderer-shallow.development.js:382:78)
      at node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:480:35
      at withSetStateAllowed (node_modules/enzyme-adapter-utils/build/Utils.js:137:16)
      at Object.render (node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:479:68)
      at new ShallowWrapper (node_modules/enzyme/build/ShallowWrapper.js:206:22)
      at shallow (node_modules/enzyme/build/shallow.js:21:10)
      at setUp (src/App.test.js:8:21)
      at Object.setUp (src/App.test.js:28:19)

Meesam avatar Sep 16 '19 06:09 Meesam