Add test to cover missed branch in strategy.

This commit is contained in:
Mike Nicholson
2017-07-27 23:46:00 -04:00
parent 1bb3d5ba52
commit ef0cecdc67
+12 -1
View File
@@ -15,13 +15,24 @@ describe('Strategy', function() {
});
it('should throw if constructed without a secretOrKey arg', function() {
it('should throw if constructed neither a secretOrKey or a secretOrKeyProvider arg', function() {
expect(function() {
var s = new Strategy({jwtFromRequest: function(r) {}, secretOrKey: null}, function() {});
}).to.throw(TypeError, 'JwtStrategy requires a secret or key');
});
it('should throw if constructed with both a secretOrKey and a secretOrKeyProvider', function () {
expect(function() {
var s = new Strategy({
secretOrKey: 'secret',
secretOrKeyProvider: function(req, token, done) {},
jwtFromReqeust: function(r) {}
});
}).to.throw(TypeError);
});
it('should throw if constructed without a jwtFromRequest arg', function() {
expect(function() {
var s = new Strategy({secretOrKey: 'secret'}, function() {});