I have the following line in my code:
var fileUrl = URL.createObjectURL(file);
Unfortunately phantomjs doesn't have URL so I need to stub it out in Jasmine, but not sure how.
I am using Jasmine 2 and AngularJS 1.4
spyOn(URL, 'createObjectURL').and.returnValue("something");
This assumes URL is accessible in your unit tests. Alternatively, another approach, is to define URL in your unit tests as ...
var URL = {
createObjectURL: function() { return "something" }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With