import { LoadingCountSetup , LoadingCountService } from './loading_count_service' ; import { BehaviorSubject } from 'rxjs' ; import type { PublicMethodsOf } from '@osd/utility-types' ; const createSetupContractMock = ( ) => { const setupContract = { addLoadingCountSource : jest . fn ( ) , getLoadingCount$ : jest . fn ( ) , } ; setupContract . getLoadingCount$ . mockReturnValue ( new BehaviorSubject ( 0 ) ) ; return setupContract ; } ; type LoadingCountServiceContract = PublicMethodsOf < LoadingCountService > ; const createServiceMock = ( ) => { const mocked = { setup : jest . fn ( ) , start : jest . fn ( ) , stop : jest . fn ( ) , } ; mocked . setup . mockReturnValue ( createSetupContractMock ( ) ) ; mocked . start . mockReturnValue ( createSetupContractMock ( ) ) ; return mocked ; } ; export const loadingCountServiceMock = { create : createServiceMock , createSetupContract : createSetupContractMock , createStartContract : createSetupContractMock , } ;