jest-fetch-mock icon indicating copy to clipboard operation
jest-fetch-mock copied to clipboard

Response should allow for passing more than just a string

Open taschmidt opened this issue 3 years ago • 0 comments

I have a unit test I'm converting over to use this library. Since the method I'm testing reads from Response.body like a stream (which follows the fetch API docs), the previous version of the unit test passed a Readable.from(... abitrary data ...). However, this lib only will allow me to pass a string.

I was able to work around it by calling fetchMock.mockResponse(Readable.from( ... ) as any) but it would be nice if I didn't have to cast.

taschmidt avatar Jul 12 '22 22:07 taschmidt