Error while trying to render inside a jest test.
See original GitHub issueI 'm trying to render BottomSheet inside a test and I’m getting
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Check the render method of `BottomSheetBehavior`.
Any hints?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
Jest test does not fail on error while rendering - Stack Overflow
I'm trying to fix some unit test that passes regardless of what happens in the rendering. import React from 'react'; import Component from...
Read more >Testing if a React component doesn't exist with Jest
Sometimes we want to write tests to check if certain elements are not rendered. For example, we might have a parameter to disable...
Read more >Troubleshooting - Jest
Tests are Failing and You Don't Know Why ... This will run Jest in a Node process that an external debugger can connect...
Read more >How to make a Jest Test for Error Boundaries
At first glance, the error itself is provided by a callback within the lifecycle of React. componentDidCatch is what will receive the error...
Read more >Unit Testing in React: Full Guide on Jest and Enzyme Testing
Don't strive for the percentages, avoid writing fake tests, and just try not to lose main component details. Defining the correct order of ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Monkeyank thanks for your response.
Now the error is
I had to mock a bunch of things that the Bottom Sheet used. Note that other things you are using that require mocking which are added to the bottom tab content can cause this problem.