I have a test which is failing on Jest 27.5.1 (with babel-jest at the same version) with this error
I’m testing using sinon with axios.
Runs a function before any of the tests in this file run. If the function returns a promise or is a generator, Jest waits for that promise to resolve before running tests.
I’m using Passport.js for authentication (local strategy) and testing with Mocha and Supertest.
Is there any way to directly access the
req object in
supertest, while/after the request is being tested? I want to test my
passport strategies, so I want to check
req.session, and perhaps others. I know I can test page redirects or flash, as those are what my strategies do, but it seems useful to see if there is a user on the
req object, as well. If I do this, I can also check how many users there are at any one time.
found the following hint on how to test middleware in express:
I was wondering why my tests were always passing. Until I noticed that when i copied the test from express they behaved the same. I tried screwing them up but they keep passing:
I am writing an integration test for a REST API protected by a
One API operation POST
/user/token is returning a
jwt given a
username and a
password and this token is then used for a list of operations such as:
I am testing an express API with supertest.
I’m using Passport.js for authentication (Facebook strategy) and testing with Mocha and Supertest. How can I create a session and make authenticated requests with Supertest for Facebook strategy?