Skip to content

Commit ef0cecd

Browse files
committedJul 28, 2017
Add test to cover missed branch in strategy.
1 parent 1bb3d5b commit ef0cecd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed
 

‎test/strategy-init-test.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,24 @@ describe('Strategy', function() {
1515
});
1616

1717

18-
it('should throw if constructed without a secretOrKey arg', function() {
18+
it('should throw if constructed neither a secretOrKey or a secretOrKeyProvider arg', function() {
1919
expect(function() {
2020
var s = new Strategy({jwtFromRequest: function(r) {}, secretOrKey: null}, function() {});
2121
}).to.throw(TypeError, 'JwtStrategy requires a secret or key');
2222
});
2323

2424

25+
it('should throw if constructed with both a secretOrKey and a secretOrKeyProvider', function () {
26+
expect(function() {
27+
var s = new Strategy({
28+
secretOrKey: 'secret',
29+
secretOrKeyProvider: function(req, token, done) {},
30+
jwtFromReqeust: function(r) {}
31+
});
32+
}).to.throw(TypeError);
33+
});
34+
35+
2536
it('should throw if constructed without a jwtFromRequest arg', function() {
2637
expect(function() {
2738
var s = new Strategy({secretOrKey: 'secret'}, function() {});

0 commit comments

Comments
 (0)
Please sign in to comment.