import type { PublicMethodsOf } from '@osd/utility-types' ; import { IUiSettingsClient , InternalUiSettingsServiceSetup , InternalUiSettingsServiceStart , } from './types' ; import { UiSettingsService } from './ui_settings_service' ; const createClientMock = ( ) => { const mocked = { getRegistered : jest . fn ( ) , get : jest . fn ( ) , getAll : jest . fn ( ) , getUserProvided : jest . fn ( ) , setMany : jest . fn ( ) , set : jest . fn ( ) , remove : jest . fn ( ) , removeMany : jest . fn ( ) , isOverridden : jest . fn ( ) , } ; mocked . get . mockResolvedValue ( false ) ; mocked . getAll . mockResolvedValue ( { } ) ; mocked . getRegistered . mockReturnValue ( { } ) ; mocked . getUserProvided . mockResolvedValue ( { } ) ; return mocked ; } ; const createSetupMock = ( ) => { const mocked = { register : jest . fn ( ) , } ; return mocked ; } ; const createStartMock = ( ) => { const mocked = { asScopedToClient : jest . fn ( ) , } ; mocked . asScopedToClient . mockReturnValue ( createClientMock ( ) ) ; return mocked ; } ; type UiSettingsServiceContract = PublicMethodsOf < UiSettingsService > ; const createMock = ( ) => { const mocked = { setup : jest . fn ( ) , start : jest . fn ( ) , stop : jest . fn ( ) , } ; mocked . setup . mockResolvedValue ( createSetupMock ( ) ) ; mocked . start . mockResolvedValue ( createStartMock ( ) ) ; return mocked ; } ; export const uiSettingsServiceMock = { createSetupContract : createSetupMock , createStartContract : createStartMock , createClient : createClientMock , create : createMock , } ;