@@ -157,18 +157,22 @@ describe('AppCheckTokenGenerator', () => {
157157 . should . eventually . be . a ( 'string' ) . and . not . be . empty ;
158158 } ) ;
159159
160- [ [ THIRTY_MIN_IN_MS , '1800s' ] , [ THIRTY_MIN_IN_MS + 1 , '1800.001000000s' ] ,
161- [ SEVEN_DAYS_IN_MS / 2 , '302400s' ] , [ SEVEN_DAYS_IN_MS - 1 , '604799.999000000s' ] , [ SEVEN_DAYS_IN_MS , '604800s' ] ]
162- . forEach ( ( ttl ) => {
163- it ( 'should be fulfilled with a Firebase Custom JWT with a valid custom ttl' + JSON . stringify ( ttl [ 0 ] ) , ( ) => {
164- return tokenGenerator . createCustomToken ( APP_ID , { ttlMillis : ttl [ 0 ] as number } )
165- . then ( ( token ) => {
166- const decoded = jwt . decode ( token ) as { [ key : string ] : any } ;
167-
168- expect ( decoded [ 'ttl' ] ) . to . equal ( ttl [ 1 ] ) ;
169- } ) ;
170- } ) ;
160+ [
161+ [ THIRTY_MIN_IN_MS , '1800s' ] ,
162+ [ THIRTY_MIN_IN_MS + 1 , '1800.001000000s' ] ,
163+ [ SEVEN_DAYS_IN_MS / 2 , '302400s' ] ,
164+ [ SEVEN_DAYS_IN_MS - 1 , '604799.999000000s' ] ,
165+ [ SEVEN_DAYS_IN_MS , '604800s' ]
166+ ] . forEach ( ( ttl ) => {
167+ it ( 'should be fulfilled with a Firebase Custom JWT with a valid custom ttl' + JSON . stringify ( ttl [ 0 ] ) , ( ) => {
168+ return tokenGenerator . createCustomToken ( APP_ID , { ttlMillis : ttl [ 0 ] as number } )
169+ . then ( ( token ) => {
170+ const decoded = jwt . decode ( token ) as { [ key : string ] : any } ;
171+
172+ expect ( decoded [ 'ttl' ] ) . to . equal ( ttl [ 1 ] ) ;
173+ } ) ;
171174 } ) ;
175+ } ) ;
172176
173177 it ( 'should be fulfilled with a JWT with the correct decoded payload' , ( ) => {
174178 clock = sinon . useFakeTimers ( 1000 ) ;
@@ -212,8 +216,12 @@ describe('AppCheckTokenGenerator', () => {
212216 } ) ;
213217 } ) ;
214218
215- [ [ 1800000.000001 , '1800.000000001s' ] , [ 1800000.001 , '1800.000000999s' ] , [ 172800000 , '172800s' ] ,
216- [ 604799999 , '604799.999000000s' ] , [ 604800000 , '604800s' ]
219+ [
220+ [ 1800000.000001 , '1800.000000001s' ] ,
221+ [ 1800000.001 , '1800.000000999s' ] ,
222+ [ 172800000 , '172800s' ] ,
223+ [ 604799999 , '604799.999000000s' ] ,
224+ [ 604800000 , '604800s' ]
217225 ] . forEach ( ( ttl ) => {
218226 it ( 'should be fulfilled with a JWT with custom ttl in decoded payload' , ( ) => {
219227 clock = sinon . useFakeTimers ( 1000 ) ;
0 commit comments