@@ -9,11 +9,11 @@ describe('JWT class tests', () => {
99 const param = 'param' ;
1010 const validity = 1 ;
1111
12- it ( 'Should throw error for invalid token in JWT.decode' , async ( ) => {
13- beforeEach ( ( ) => {
14- readFileSpy . mockClear ( ) ;
15- } ) ;
12+ beforeEach ( ( ) => {
13+ readFileSpy . mockClear ( ) ;
14+ } ) ;
1615
16+ it ( 'Should throw error for invalid token in JWT.decode' , async ( ) => {
1717 try {
1818 await JWT . decode ( 'abc' ) ;
1919 } catch ( e ) {
@@ -24,10 +24,6 @@ describe('JWT class tests', () => {
2424 } ) ;
2525
2626 it ( 'Should generate a token for JWT.encode' , async ( ) => {
27- beforeEach ( ( ) => {
28- readFileSpy . mockClear ( ) ;
29- } ) ;
30-
3127 const payload = new JwtPayload ( issuer , audience , subject , param , validity ) ;
3228 const token = await JWT . encode ( payload ) ;
3329
@@ -36,10 +32,6 @@ describe('JWT class tests', () => {
3632 } ) ;
3733
3834 it ( 'Should decode a valid token for JWT.decode' , async ( ) => {
39- beforeEach ( ( ) => {
40- readFileSpy . mockClear ( ) ;
41- } ) ;
42-
4335 const payload = new JwtPayload ( issuer , audience , subject , param , validity ) ;
4436 const token = await JWT . encode ( payload ) ;
4537 const decoded = await JWT . decode ( token ) ;
@@ -49,10 +41,6 @@ describe('JWT class tests', () => {
4941 } ) ;
5042
5143 it ( 'Should parse an expired token for JWT.decode' , async ( ) => {
52- beforeEach ( ( ) => {
53- readFileSpy . mockClear ( ) ;
54- } ) ;
55-
5644 const time = Math . floor ( Date . now ( ) / 1000 ) ;
5745
5846 const payload = {
@@ -71,10 +59,6 @@ describe('JWT class tests', () => {
7159 } ) ;
7260
7361 it ( 'Should throw error for invalid token in JWT.validate' , async ( ) => {
74- beforeEach ( ( ) => {
75- readFileSpy . mockClear ( ) ;
76- } ) ;
77-
7862 try {
7963 await JWT . validate ( 'abc' ) ;
8064 } catch ( e ) {
@@ -85,10 +69,6 @@ describe('JWT class tests', () => {
8569 } ) ;
8670
8771 it ( 'Should validate a valid token for JWT.validate' , async ( ) => {
88- beforeEach ( ( ) => {
89- readFileSpy . mockClear ( ) ;
90- } ) ;
91-
9272 const payload = new JwtPayload ( issuer , audience , subject , param , validity ) ;
9373 const token = await JWT . encode ( payload ) ;
9474 const decoded = await JWT . validate ( token ) ;
@@ -98,10 +78,6 @@ describe('JWT class tests', () => {
9878 } ) ;
9979
10080 it ( 'Should validate a token expiry for JWT.validate' , async ( ) => {
101- beforeEach ( ( ) => {
102- readFileSpy . mockClear ( ) ;
103- } ) ;
104-
10581 const time = Math . floor ( Date . now ( ) / 1000 ) ;
10682
10783 const payload = {
0 commit comments