@@ -407,22 +407,42 @@ describe("Vesting", () => {
407407 let vestingStartTime = BigInt ( await time . latest ( ) ) ;
408408 let timestampUpTo = vestingStartTime ;
409409
410+ await vesting . createSchedule ( defaultSchedule ) ;
411+
410412 expect ( await vesting . vestingCalculation ( scheduleId , vestingAmount , vestingStartTime , timestampUpTo ) ) . to . be . equal (
411413 0 ,
412414 ) ;
413415 } ) ;
414416
415417 it ( "should return 0 if cliff is active" , async ( ) => {
416418 let vestingStartTime = BigInt ( await time . latest ( ) ) ;
417- let timestampUpTo = vestingStartTime + secondsInPeriod ;
419+ let timestampUpTo = vestingStartTime + secondsInPeriod * 2n ;
418420
419- defaultSchedule . scheduleData . cliffInPeriods = 2n ;
421+ defaultSchedule . scheduleData . cliffInPeriods = 3n ;
420422
421423 await vesting . createSchedule ( defaultSchedule ) ;
422424
423425 expect ( await vesting . vestingCalculation ( scheduleId , vestingAmount , vestingStartTime , timestampUpTo ) ) . to . be . equal (
424426 0 ,
425427 ) ;
426428 } ) ;
429+
430+ it ( "should return correct tokens amount right after cliff period is over" , async ( ) => {
431+ let vestingStartTime = BigInt ( await time . latest ( ) ) ;
432+ let timestampUpTo = vestingStartTime + secondsInPeriod * 3n + 1n ;
433+
434+ const newCliffInPeriods = 3n ;
435+ const someVestingAmount = wei ( 120_000 ) ;
436+ const expectedAmount = ( someVestingAmount / durationInPeriods ) * newCliffInPeriods ;
437+
438+ defaultSchedule . scheduleData . cliffInPeriods = newCliffInPeriods ;
439+ defaultSchedule . exponent = 1 ;
440+
441+ await vesting . createSchedule ( defaultSchedule ) ;
442+
443+ expect (
444+ await vesting . vestingCalculation ( scheduleId , someVestingAmount , vestingStartTime , timestampUpTo ) ,
445+ ) . to . be . equal ( expectedAmount ) ;
446+ } ) ;
427447 } ) ;
428448} ) ;
0 commit comments