I have component in React which I\'m trying to test with Jest, unfortunately test do not pass.
The component code:
import React, {Component} from \'react
It's something different when you're using @material-ui.
You've to use @material-ui's Built-in API(s). Such as createMount, createShallow, createRender in order to use enzyme's shallow, mount & render.
These APIs are built on top of enzyme, so you can't use enzyme directly for testing @material-ui.
Shallow Rendering with @material-uiimport { createShallow } from '@material-ui/core/test-utils';
describe(' ', () => {
let shallow;
before(() => {
shallow = createShallow();
});
it('should work', () => {
const wrapper = shallow( );
});
});
Reference: Official Docs of @material-ui