Skip to content

Commit

Permalink
improve async test
Browse files Browse the repository at this point in the history
  • Loading branch information
jfromaniello committed Apr 29, 2016
1 parent 252110e commit 7b09813
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions test/async_sign.tests.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
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 (err, asyncToken) {
if (err) return done(err);
var syncToken = jwt.sign({ foo: 'bar' }, secret, { algorithm: 'HS256' });
expect(asyncToken).to.be.a('string');
expect(asyncToken.split('.')).to.have.length(3);
expect(asyncToken).to.equal(syncToken);
Expand Down

0 comments on commit 7b09813

Please sign in to comment.