Compressor js React testing library JEST

Viewed 10

I am doing the unit test with jest and react-testing-library and in the part where a user uploads an image and once they upload it, they compress it, for that I am using the compressjs library.

But when you get to the compress part it doesn't go into success, could someone help me with it?

 new Compressor(e.target.files[0], {
            quality: 0.8,
            success: (compressedResult) => {
                console.log("compressedResult", compressedResult)
                let newFile = new File([compressedResult], `${uuidv4()}-avatar`, {type: 'image/png'})
                setRenderPhoto(newFile)
            }
        })
0 Answers
Related