Enzyme test fails when using react-email-editor and TypeScript
To Reproduce
Clone this repo.
Run yarn.
Run yarn test.
Expected behavior
The test should pass with no warning. Although the test passes, doing other tests with the EmailEditor component will fail for the same reason as the warning given:
React.createElement: 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.
Code
unlayer.tsx:
import * as React from 'react';
import EmailEditor from 'react-email-editor';
const Unlayer: React.FC = () => <EmailEditor />;
export default Unlayer;
unalyer.test.tsx:
import * as React from 'react';
import { shallow } from 'enzyme';
import Unlayer from './unlayer';
test('component renders', () => {
expect(shallow(<Unlayer />).length).toBe(1);
});
@adeelraza is there any update on this?
3 years later and still no response!
are there ANY examples of testing? can't seem to find any tests in the source of the EmailEditor component either!