Skip to content

Commit

Permalink
fix encoding issue. closes auth0#40
Browse files Browse the repository at this point in the history
  • Loading branch information
jfromaniello committed Dec 29, 2014
1 parent 0aad516 commit b648358
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: node_js
before_install: npm i -g npm@1.4.28
node_js:
- 0.8
- 0.10
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@
"url": "https://github.com/auth0/node-jsonwebtoken/issues"
},
"dependencies": {
"jws": "~0.2.6"
"jws": "~1.0.0"
},
"devDependencies": {
"chai": "*",
"mocha": "*"
"atob": "~1.1.2",
"chai": "~1.10.0",
"mocha": "~2.1.0"
},
"engines": {
"npm": "~1.4.28"
}
}
14 changes: 14 additions & 0 deletions test/encoding.tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var jwt = require('../index');
var expect = require('chai').expect;
var atob = require('atob');

describe('encoding', function() {

it('should properly encode the token', function () {
var expected = 'José';
var token = jwt.sign({ name: expected }, 'shhhhh');
var decoded_name = JSON.parse(atob(token.split('.')[1])).name;
expect(decoded_name).to.equal(expected);
});

});

0 comments on commit b648358

Please sign in to comment.