Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
67bba6335c | |||
eaef5d3d78 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartjwt",
|
"name": "@pushrocks/smartjwt",
|
||||||
"version": "1.0.6",
|
"version": "1.0.7",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartjwt",
|
"name": "@pushrocks/smartjwt",
|
||||||
"version": "1.0.6",
|
"version": "1.0.7",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a package for handling jwt",
|
"description": "a package for handling jwt",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
15
test/test.ts
15
test/test.ts
@ -15,7 +15,7 @@ tap.test('should create a valid jwt', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should create a new jwt', async () => {
|
tap.test('should create a new jwt', async () => {
|
||||||
testJwt = await smartjwtInstance.createJWT({hi: 'there'});
|
testJwt = await smartjwtInstance.createJWT({ hi: 'there' });
|
||||||
console.log(testJwt);
|
console.log(testJwt);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -24,5 +24,18 @@ tap.test('should verify a jwt', async () => {
|
|||||||
console.log(data);
|
console.log(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test('should not verify a wrong jwt', async () => {
|
||||||
|
const jwt2 = await smartjwtInstance.createJWT({ wow: 'soclear' });
|
||||||
|
const jwt2Array = jwt2.split('.');
|
||||||
|
const testJwtArray = testJwt.split('.');
|
||||||
|
const newJwt = `${testJwtArray[0]}.${jwt2Array[1]}.${testJwtArray[2]}`;
|
||||||
|
let error: Error;
|
||||||
|
try {
|
||||||
|
await smartjwtInstance.verifyJWTAndGetData(newJwt);
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
expect(error).to.be.instanceOf(Error);
|
||||||
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
Reference in New Issue
Block a user