Needed help to write unit test for image download
Hey there, I wanted to write test for the handleShareClick function, this function uses html2canvas lib and I am not sure how I acna write a unit test using jest. PS I am new to testing. Here is the code:
const handleShareClick = () => {
html2canvas(document.querySelector('#share')!).then(canvas => {
const dataURL = canvas.toDataURL();
const a = document.createElement('a');
a.setAttribute('download', `${Math.floor(Date.now() / 1000)}-success`);
a.setAttribute('href', dataURL);
a.click();
});
};
2 Replies
Don't you know we don't write unit tests here 👀
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View