mirror of
https://github.com/hanzoai/passport-jwt.git
synced 2026-09-24 17:01:40 +00:00
Add test to cover missed branch in strategy.
This commit is contained in:
@@ -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() {});
|
||||
|
||||
Reference in New Issue
Block a user