I'm busy getting into unit testing with React, Jest and Enzyme.
I've got a component that takes a PDF File
as a prop, see this interface:
interface IProps {
file: File;
}
I'm trying to do a straight up basic test just to make sure the component renders without crashing using it's required props (i.e. the File
).
Here's my test case:
describe('MyComponent', () => {
const props = {
file: /* How do I mock this file? */
};
it('renders without crashing', () => {
mount(<MyComponent {...props} />);
});
});
How do I mock a File
for the file
prop?