We use mocha to conduct tests of a custom js stack that stitches together Express, Passport, Backbone, and Dust.
We'd like to use Mocha to simulate authorized logins as closely as possible, but ultimately to use a mock Passport middleware, i.e. like this, but without having to write another entire Express stack, since ours is pretty complex and we'd like to avoid duplicating it.
I'm having trouble mocking passport authentication in my mocha tests. I've looked through some of the responses to similar questions here but these all reflect different use cases.
In our express middleware, we call something like
app.use(separatePassportConfigFile)
Is there a way that, when testing, we can use a different passport configuration?