diff --git a/lib/authenticator.js b/lib/authenticator.js index d374eb2f..913df9a9 100644 --- a/lib/authenticator.js +++ b/lib/authenticator.js @@ -243,11 +243,10 @@ Authenticator.prototype.session = function session(options) { * @api public */ -Authenticator.prototype.sessionManager = function(mgr) { +Authenticator.prototype.sessionManager = function sessionManager(mgr) { this._sm = mgr; return this; -} - +}; /** * Registers a function used to serialize user objects into the session. diff --git a/test/authenticator.test.js b/test/authenticator.test.js index 1dd229ba..49f43ee0 100644 --- a/test/authenticator.test.js +++ b/test/authenticator.test.js @@ -7,6 +7,17 @@ const Authenticator = require('../lib/authenticator'); describe('Authenticator', () => { + + describe('#sessionManager', () => { + it('should set custom session manager', () => { + const passport = new Authenticator(); + const sessionManager = {}; + passport.sessionManager(sessionManager); + + expect(passport._sm).to.equal(sessionManager); + }); + }); + describe('#use', () => { describe('with instance name', () => { function Strategy() {