We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to use moxios to mock the following scenario.
axios.default.get(imageUrl, { responseType: 'stream' })
To unit test the above, I am trying to write jest with the following.
moxios.stubRequest('http://abc.com/text.jpg', { status: 200, response: { data: fs.createReadStream(`${__dirname}/text.png`) } });
But the response.data. When I use response.data.pipe(somewriteablestream) it does not work.
Any help appreciated for mocking a get request returning a stream object.
The text was updated successfully, but these errors were encountered:
Just pass fs.createReadStream directly.
fs.createReadStream
moxios.stubRequest('/text.png', { status: 200, response: fs.createReadStream(`${__dirname}/text.png`), })
Sorry, something went wrong.
No branches or pull requests
I am trying to use moxios to mock the following scenario.
axios.default.get(imageUrl, { responseType: 'stream' })
To unit test the above, I am trying to write jest with the following.
But the response.data. When I use response.data.pipe(somewriteablestream) it does not work.
Any help appreciated for mocking a get request returning a stream object.
The text was updated successfully, but these errors were encountered: