I am using the local strategy of Passport.js to authenticate users for my API. I am writing tests for this API, and I need a way of mocking Passport.js in the tests to simulate
One possible option: in your test setup, you can passport.use a mock strategy under the local name:
passport.use
passport.use('local', new MockStrategy());
Implement MockStrategy to pass the request, or whatever your test needs.