You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							21 lines
						
					
					
						
							646 B
						
					
					
				
			
		
		
	
	
							21 lines
						
					
					
						
							646 B
						
					
					
				var jwt = require('../index');
 | 
						|
 | 
						|
var expect = require('chai').expect;
 | 
						|
 | 
						|
describe('signing a token asynchronously', function() {
 | 
						|
 | 
						|
  describe('when signing a token', function() {
 | 
						|
    var secret = 'shhhhhh';
 | 
						|
    var syncToken = jwt.sign({ foo: 'bar' }, secret, { algorithm: 'HS256' });
 | 
						|
 | 
						|
    it('should return the same result as singing synchronously', function(done) {
 | 
						|
      jwt.sign({ foo: 'bar' }, secret, { algorithm: 'HS256' }, function (asyncToken) {
 | 
						|
        expect(asyncToken).to.be.a('string');
 | 
						|
        expect(asyncToken.split('.')).to.have.length(3);
 | 
						|
        expect(asyncToken).to.equal(syncToken);
 | 
						|
        done();
 | 
						|
      });
 | 
						|
    });
 | 
						|
  });
 | 
						|
});
 |