michangarrito/apps/backend/node_modules/passport-jwt/test/strategy-init-test.js
rckrdmrd 48dea7a5d0 feat: Initial commit - michangarrito
Marketplace móvil para negocios locales mexicanos.

Estructura inicial:
- apps/backend (NestJS API)
- apps/frontend (React Web)
- apps/mobile (Expo/React Native)
- apps/mcp-server (Claude MCP Server)
- apps/whatsapp-service (WhatsApp Business API)
- database/ (PostgreSQL DDL)
- docs/ (Documentación)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 04:41:02 -06:00

42 lines
1.4 KiB
JavaScript

var Strategy = require('../lib/strategy');
describe('Strategy', function() {
var strategy = new Strategy({jwtFromRequest: function(){}, secretOrKey: 'secret'}, function() {});
it('should be named jwt', function() {
expect(strategy.name).to.equal('jwt');
});
it('should throw if constructed without a verify callback', function() {
expect(function() {
var s = new Strategy({jwtFromRequest: function(r) {}, secretOrKey: 'secret'});
}).to.throw(TypeError, "JwtStrategy requires a verify callback");
});
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) {},
jwtFromRequest: function(r) {}
});
}).to.throw(TypeError);
});
it('should throw if constructed without a jwtFromRequest arg', function() {
expect(function() {
var s = new Strategy({secretOrKey: 'secret'}, function() {});
}).to.throw(TypeError);
});
});