import * as Rx from 'rxjs' ; import type { PublicMethodsOf } from '@osd/utility-types' ; import { UiSettingsService } from './' ; import { IUiSettingsClient } from './types' ; const createSetupContractMock = ( ) => { const setupContract = { getAll : jest . fn ( ) , get : jest . fn ( ) , get$ : jest . fn ( ) , set : jest . fn ( ) , remove : jest . fn ( ) , isDeclared : jest . fn ( ) , isDefault : jest . fn ( ) , isCustom : jest . fn ( ) , isOverridden : jest . fn ( ) , overrideLocalDefault : jest . fn ( ) , getUpdate$ : jest . fn ( ) , getSaved$ : jest . fn ( ) , getUpdateErrors$ : jest . fn ( ) , } ; setupContract . get$ . mockReturnValue ( new Rx . Subject < any > ( ) ) ; setupContract . getUpdate$ . mockReturnValue ( new Rx . Subject < any > ( ) ) ; setupContract . getSaved$ . mockReturnValue ( new Rx . Subject < any > ( ) ) ; setupContract . getUpdateErrors$ . mockReturnValue ( new Rx . Subject < any > ( ) ) ; setupContract . getAll . mockReturnValue ( { } ) ; return setupContract ; } ; type UiSettingsServiceContract = PublicMethodsOf < UiSettingsService > ; const createMock = ( ) => { const mocked = { setup : jest . fn ( ) , start : jest . fn ( ) , stop : jest . fn ( ) , } ; mocked . setup . mockReturnValue ( createSetupContractMock ( ) ) ; return mocked ; } ; export const uiSettingsServiceMock = { create : createMock , createSetupContract : createSetupContractMock , createStartContract : createSetupContractMock , } ;