Skip to content

Commit 1364b59

Browse files
committed
test: add test for buffer payload input
1 parent 3c9718d commit 1364b59

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

test/jws.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,3 +330,16 @@ test('jws.isValid', function (t) {
330330
t.same(jws.isValid(valid), true);
331331
t.end();
332332
});
333+
334+
test('#50 mangled binary payload', function(t) {
335+
const sig = jws.sign({
336+
header: {
337+
alg: 'HS256'
338+
},
339+
payload: new Buffer('TkJyotZe8NFpgdfnmgINqg==', 'base64'),
340+
secret: new Buffer('8NRxgIkVxP8LyyXSL4b1dg==', 'base64')
341+
});
342+
343+
t.same(sig, 'eyJhbGciOiJIUzI1NiJ9.TkJyotZe8NFpgdfnmgINqg.9XilaLN_sXqWFtlUCdAlGI85PCEbJZSIQpakyAle-vo');
344+
t.end();
345+
});

0 commit comments

Comments
 (0)