import type { PublicMethodsOf } from '@osd/utility-types' ; import { CapabilitiesService , CapabilitiesSetup , CapabilitiesStart } from './capabilities_service' ; import { Capabilities } from './types' ; const createSetupContractMock = ( ) => { const setupContract = { registerProvider : jest . fn ( ) , registerSwitcher : jest . fn ( ) , } ; return setupContract ; } ; const createStartContractMock = ( ) => { const setupContract = { resolveCapabilities : jest . fn ( ) . mockReturnValue ( Promise . resolve ( { } ) ) , } ; return setupContract ; } ; const createCapabilitiesMock = ( ) : Capabilities => { return { navLinks : { } , management : { } , catalogue : { } , } ; } ; type CapabilitiesServiceContract = PublicMethodsOf < CapabilitiesService > ; const createMock = ( ) => { const mocked = { setup : jest . fn ( ) . mockReturnValue ( createSetupContractMock ( ) ) , start : jest . fn ( ) . mockReturnValue ( createStartContractMock ( ) ) , } ; return mocked ; } ; export const capabilitiesServiceMock = { create : createMock , createSetupContract : createSetupContractMock , createStartContract : createStartContractMock , createCapabilities : createCapabilitiesMock , } ;