thoughts/node_modules/jsonwebtoken/test/issue_196.tests.js
node_modules/jsonwebtoken/test/issue_196.tests.jsRaw
1var expect = require('chai').expect;
2var jwt = require('./..');
3var atob = require('atob');
4
5describe('issue 196', function () {
6 function b64_to_utf8 (str) {
7 return decodeURIComponent(escape(atob( str )));
8 }
9
10 it('should use issuer provided in payload.iss', function () {
11 var token = jwt.sign({ iss: 'foo' }, 'shhhhh');
12 var decoded_issuer = JSON.parse(b64_to_utf8(token.split('.')[1])).iss;
13 expect(decoded_issuer).to.equal('foo');
14 });
15});