Skip to content

Commit

Permalink
Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson committed May 19, 2022
1 parent 294f22c commit c1991cf
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/http/request.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,35 @@ describe('http.ServerRequest', function() {
});
});

describe('establishing a session without session support', function() {
var passport = new Passport();
passport.serializeUser(function(user, done) {
done(null, user.id);
});

var req = new Object();
req.login = request.login;
req._passport = {};
req._passport.instance = passport;
req._sessionManager = passport._sm;

var error;

before(function(done) {
var user = { id: '1', username: 'root' };

req.login(user, function(err) {
error = err;
done();
});
});

it('should error', function() {
expect(error).to.be.an.instanceOf(Error);
expect(error.message).to.equal('Login sessions require session support. Did you forget to use `express-session` middleware?');
});
});

});


Expand Down

0 comments on commit c1991cf

Please sign in to comment.