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 71c54f6 commit cc7606c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/http/request.test.js
Expand Up @@ -525,6 +525,36 @@ describe('http.ServerRequest', function() {
});
});

describe('existing session, without passport.initialize() middleware, and invoked with a callback', function() {
var req = new Object();
req.logout = request.logout;
req.isAuthenticated = request.isAuthenticated;
req.isUnauthenticated = request.isUnauthenticated;
req.user = { id: '1', username: 'root' };

var error;

before(function(done) {
req.logout(function(err) {
error = err;
done();
});
});

it('should not error', function() {
expect(error).to.be.undefined;
});

it('should not be authenticated', function() {
expect(req.isAuthenticated()).to.be.false;
expect(req.isUnauthenticated()).to.be.true;
});

it('should clear user', function() {
expect(req.user).to.be.null;
});
});

describe('existing session, but not passing a callback argument', function() {
var passport = new Passport();
passport.serializeUser(function(user, done) {
Expand Down

0 comments on commit cc7606c

Please sign in to comment.