react-dropzone-uploader
react-dropzone-uploader copied to clipboard
Can't test using testing library
I want to test a upload response using react dropzone upload and testing-library, but i can't. When i try to use userEvent.upload, react dropzone breaks.
render(<View/>);
await new Promise((r) => setTimeout(r, 500));
const infos = within(screen.getByTestId('infos'));
await waitFor(() => expect(infos.getByText('R$ 2.400,00')).toBeInTheDocument());
const uploadForm = screen.getAllByTestId('upload-form');
fireEvent.drop(uploadForm[3], {
dataTransfer: {
files: [new File(['(⌐□_□)'], 'chucknorris.png', { type: 'image/png' })]
}
});
await waitFor(() =>
expect(screen.getByText('chucknorris.jpg enviado com sucesso!')).toBeInTheDocument()
);
Open Proposal - Upload Files › test document upload success for holerite
TypeError: URL.createObjectURL is not a function
at node_modules/react-dropzone-uploader/dist/react-dropzone-uploader.js:14:15637