From eaef5d3d78ca411d73a017b2c7795b2cb164be8d Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 1 Oct 2019 19:22:02 +0200 Subject: [PATCH] fix(core): update --- test/test.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/test.ts b/test/test.ts index 17032c6..64f8991 100644 --- a/test/test.ts +++ b/test/test.ts @@ -15,7 +15,7 @@ tap.test('should create a valid 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); }); @@ -24,5 +24,18 @@ tap.test('should verify a jwt', async () => { 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();