Jest URL.createObjectURL is not a function

前端 未结 4 1472
[愿得一人]
[愿得一人] 2021-01-17 07:39

I\'m developping a reactJs application. I\'m using jest to test my application. I want to test a function that download a blob.

But unfortunately I receve this error

4条回答
  •  天涯浪人
    2021-01-17 07:57

    You just have to Write this in your setupTest.js

    window.URL.createObjectURL = function() {};
    

提交回复
热议问题