Skip to content

Commit 603e92a

Browse files
committedMar 15, 2021
Finish strengthening tests.
1 parent 941519a commit 603e92a

File tree

3 files changed

+593
-46
lines changed

3 files changed

+593
-46
lines changed
 

‎test/V1.test.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,9 @@ describe('Protocol V1', () => {
407407
if (err) { return done(err); }
408408
assert.ok(token);
409409

410-
V2.decrypt(token, key, '', function(err, token) {
410+
V2.decrypt(token, key, '', function(err, data) {
411411
assert.ok(err);
412-
assert.ok(!token);
413-
412+
assert.ok(!data);
414413
assert.ok(err instanceof InvalidVersionError);
415414
assert.equal(err.message, 'The given key is not intended for this version of PASETO.');
416415

@@ -427,7 +426,7 @@ describe('Protocol V1', () => {
427426

428427
// nest so that we catch the right error
429428
return V2.decrypt(token, key, '')
430-
.then((token) => {
429+
.then((data) => {
431430
assert.ok(false); // fail if we go through here
432431
})
433432
.catch((err) => {
@@ -795,9 +794,9 @@ describe('Protocol V1', () => {
795794
if (err) { return done(err); }
796795
assert.ok(token);
797796

798-
V2.verify(token, pk, '', function(err, token) {
797+
V2.verify(token, pk, '', function(err, verified) {
799798
assert.ok(err);
800-
assert.ok(!token);
799+
assert.ok(!verified);
801800

802801
assert.ok(err instanceof InvalidVersionError);
803802
assert.equal(err.message, 'The given key is not intended for this version of PASETO.');
@@ -815,7 +814,7 @@ describe('Protocol V1', () => {
815814

816815
// nest so that we catch the right error
817816
return V2.verify(token, pk, '')
818-
.then((token) => {
817+
.then((verified) => {
819818
assert.ok(false); // fail if we go through here
820819
})
821820
.catch((err) => {
@@ -838,7 +837,7 @@ describe('Protocol V1', () => {
838837
const token = await V1.sign('test', sk, '');
839838
assert.ok(token);
840839

841-
const data = await V2.verify(token, pk, '')
840+
const verified = await V2.verify(token, pk, '')
842841
assert.ok(false); // fail if we go through here
843842
})().catch((err) => {
844843
assert.ok(err);

0 commit comments

Comments
 (0)
Failed to load comments.