-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Luke William Westby
committed
Sep 27, 2015
1 parent
6a715a1
commit 9414fbc
Showing
2 changed files
with
31 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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(); | ||
}); | ||
}); | ||
}); | ||
}); |