import type { PublicMethodsOf } from '@osd/utility-types' ; import { injectedMetadataServiceMock } from '../injected_metadata/injected_metadata_service.mock' ; import { DocLinksService , DocLinksStart } from './doc_links_service' ; const createStartContractMock = ( ) : DocLinksStart => { const injectedMetadata = injectedMetadataServiceMock . createStartContract ( ) ; injectedMetadata . getOpenSearchDashboardsBranch . mockReturnValue ( 'mocked-test-branch' ) ; return new DocLinksService ( ) . start ( { injectedMetadata } ) ; } ; type DocLinksServiceContract = PublicMethodsOf < DocLinksService > ; const createMock = ( ) : jest . Mocked < DocLinksServiceContract > => ( { setup : jest . fn ( ) . mockReturnValue ( undefined ) , start : jest . fn ( ) . mockReturnValue ( createStartContractMock ( ) ) , } ) ; export const docLinksServiceMock = { create : createMock , createSetupContract : ( ) => jest . fn ( ) , createStartContract : createStartContractMock , } ;