2

I am trying to get my unit test working. It currently fails with:

TypeError: URL.createObjectURL is not a function

I eventually stumble upon:

So I am now providing the following mock:

  test('my test', async (): Promise<void> => {
    window.URL.createObjectURL = (object: any): string => object.toString();

However this makes eslint reports now:

Avoid referencing unbound methods which may cause unintentional scoping of `this`.

Even after reading twice:

It feels like (object: any): string => object.toString() is correct here. What am I missing / misunderstanding ?

malat
  • 12,152
  • 13
  • 89
  • 158

0 Answers0