@@ -1258,6 +1258,10 @@ describe('node-vault', () => {
12581258 expect ( ( ) => vault . startLeaseRenewal ( null , 100 ) ) . to . throw ( 'leaseId is required' ) ;
12591259 } ) ;
12601260
1261+ it ( 'should throw if leaseId is empty string' , ( ) => {
1262+ expect ( ( ) => vault . startLeaseRenewal ( '' , 100 ) ) . to . throw ( 'leaseId is required' ) ;
1263+ } ) ;
1264+
12611265 it ( 'should throw if leaseDuration is not positive' , ( ) => {
12621266 expect ( ( ) => vault . startLeaseRenewal ( 'lease-1' , 0 ) ) . to . throw ( 'leaseDuration must be positive' ) ;
12631267 } ) ;
@@ -1308,10 +1312,12 @@ describe('node-vault', () => {
13081312 response . body = { lease_duration : 100 , renewable : true } ;
13091313 vault . startLeaseRenewal ( 'lease-1' , 100 ) ;
13101314 vault . startLeaseRenewal ( 'lease-2' , 200 ) ;
1311- await clock . tickAsync ( 80 * 1000 ) ; // Only lease-1 should renew
1315+ // At t=80s: lease-1 renews (80% of 100s)
1316+ await clock . tickAsync ( 80 * 1000 ) ;
13121317 request . callCount . should . equal ( 1 ) ;
1313- await clock . tickAsync ( 80 * 1000 ) ; // lease-2 should renew at 160s
1314- request . callCount . should . equal ( 3 ) ; // lease-1 renewed again + lease-2 first renewal
1318+ // At t=160s: lease-1 renews again (80% of 100s) + lease-2 renews (80% of 200s)
1319+ await clock . tickAsync ( 80 * 1000 ) ;
1320+ request . callCount . should . equal ( 3 ) ;
13151321 } ) ;
13161322 } ) ;
13171323
0 commit comments