I'm trying to write a test in jest for a component that uses react-redux but i am having an error related to the import. I believe it may be something with the way I export the component.

I created a dummy test without the import and it works normally. Only when I try to import the component that the error occurs

This is how the component is exported

export default connect(
  mapStateToProps,
  mapDispatchToProps,
)(WithPageLayout(DetailsMember));

and this is the simple test

import DetailsMember from './DetailsMember';

describe('form validator class', () => {
    it('initilizes constructor correctly', () => {
        const test = true;
        expect(test).toBeTruthy();
    });
});

1 Answers

0
Tomer Levi On

You should include import React from 'react'; in your test file as well.