Access Chrome URL object in ember test

1.6k views Asked by At

I am testing an ember component that will do a call to an external method that returns a promise and calls the createObjectURL from the URL object of the navigator:

    @fetch(@get 'self').then((blob) =>
      url = URL.createObjectURL blob
      @set 'url', url
    )

However, test will always return:

TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.

I have tried to create a service and inject it, create an object and pass it to the @subject() method, but still. Is there any way to access the window.URL object of the chrome browser inside an ember test?

1

There are 1 answers

0
Urco On

I've just found an answer here: Failed to execute 'createObjectURL' on 'URL':

I need to create a blob previously and then pass it to the createObjectURL function.