Test using testing-library
What I'm trying to achieve: test my component (which is simply a div wrapping around DatePicker to apply some styling) using testing-library
To Reproduce
npm run test: fails with the following 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.
What I have tried so far
- mocking the library:
jest.mock('react-datepicker', () => ({
default: () => {
return <></>;
},
}));
Screenshots
component implementation

test file

terminal output

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 10 days.
This issue was closed because it has been stalled for 10 days with no activity.