After updating from MUI v4 to version v5, I encountered failing tests with the following error:
TypeError: Cannot read properties of undefined (reading 'keyboardDate')
17 | it("should render correctly without any errors", () => {
18 | expect(
> 19 | renderer.create(<DatePickerElement onChange={onChange} value="10/08/1981" />).toJSON(),
| ^
20 | ).toMatchSnapshot();
21 | });
22 | // props testing
I followed the migration guide thoroughly and wrapped the component with a new
<LocalizationProvider dateAdapter={AdapterDateFns} utils={DateFnsUtils}>
. The component works fine but the tests keep failing at the render method. Has anyone else experienced a similar issue?
it("should render correctly without any errors", () => {
expect(
renderer
.create(<DatePickerElement onChange={onChange} value="10/08/1981" />)
.toJSON(),
).toMatchSnapshot(); });