Hello, my name is Filipe.
I didn’t find in the documentation how I can mock Lottie when testing in React. The way I’m mocking is showing this error:
My test:
import React from 'react';
import { act, create } from 'react-test-renderer';
import HomeAnimation from './HomeAnimation';
function MockedLottie({ className, option, height, width }) {
return (
<div
className={className}
option={option}
height={height}
width={width}
></div>
);
}
jest.mock("react-lottie", () => MockedLottie);
describe('HomeAnimation component', () => {
describe('When the component is renderer', () => {
it('should render content correctly', async () => {
let wrapper;
await act( async () => { wrapper = create(<HomeAnimation />) })
expect(wrapper.toJSON()).toMatchSnapshot()
});
});
});
Can a developer help me??