'use strict' ; import assert from 'assert' ; import { BasicJobHandler } from '../../../app/plugin/scheduler-manager/BasicJobHandler' ; describe ( 'BasicJobHandler' , ( ) => { class MockJob { cCounter = 0 ; rCounter = 0 ; nCounter = 0 ; cancel ( ) { this . cCounter ++ ; } reschedule ( ) { this . rCounter ++ ; } nextInvocation ( ) { this . nCounter ++ ; } } const job = new MockJob ( ) as any ; const jobHandler = new BasicJobHandler ( job ) ; it ( 'constructor() should set jobHandler.job' , async ( ) => { assert . deepStrictEqual ( ( jobHandler as any ) . job , job ) ; } ) ; it ( 'cancel() should call job.cancel()' , async ( ) => { jobHandler . cancel ( ) ; assert . deepStrictEqual ( job . cCounter , 1 ) ; } ) ; it ( 'reschedule() should call job.reschedule()' , async ( ) => { jobHandler . reschedule ( 'time' ) ; assert . deepStrictEqual ( job . rCounter , 1 ) ; } ) ; it ( 'nextScheduleTime() should call job.nextInvocation()' , async ( ) => { jobHandler . nextScheduleTime ( ) ; assert . deepStrictEqual ( job . nCounter , 1 ) ; } ) ; } ) ;