smartjwt/test/test.ts

29 lines
739 B
TypeScript
Raw Normal View History

2019-02-22 23:48:01 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
2019-02-22 23:50:21 +00:00
import * as smartjwt from '../ts/index';
2019-02-22 23:48:01 +00:00
2019-10-01 16:04:43 +00:00
let smartjwtInstance: smartjwt.SmartJwt;
2019-10-01 17:07:59 +00:00
let testJwt: string;
2019-10-01 16:04:43 +00:00
tap.test('should create a valid instance', async () => {
smartjwtInstance = new smartjwt.SmartJwt();
await smartjwtInstance.createNewKeyPair();
console.log(smartjwtInstance);
});
tap.test('should create a valid jwt', async () => {
2019-10-01 17:07:59 +00:00
await smartjwtInstance.createNewKeyPair();
});
tap.test('should create a new jwt', async () => {
testJwt = await smartjwtInstance.createJWT({hi: 'there'});
console.log(testJwt);
2019-02-22 23:50:21 +00:00
});
2019-02-22 23:48:01 +00:00
2019-10-01 17:07:59 +00:00
tap.test('should verify a jwt', async () => {
const data = await smartjwtInstance.verifyJWTAndGetData(testJwt);
console.log(data);
});
2019-02-22 23:50:21 +00:00
tap.start();