Skip to content

Tag: jestjs

Javascript Mocking functions that return Readable

I have a simple function that calls my s3 service which will return a Promise I would like to mock the return of the object and assert it in the test like this: When i run the test, I face this error: Error [ERR_METHOD_NOT_IMPLEMENTED]: The _read() method is not implemented at Readable.read (internal/streams/…

Testing window.location in jest

I am trying to test the window functionality via jest. I have a function which appends a query param to the url and redirects the page to the other page. A rough snippet of the code is below: I am new to jest and I am facing a bit of difficulty simulating the mock test for this, hence can you

Issue with setting up jest mock

I have the following function that is used within cypress tests for which I want to do unit testing (filterTests.js): A test double for Cypress.env needs to be created. I’m not sure if this would technically be considered a stub, mock, fake, dummy, etc…, but the philosophical discussion isn’…