import type { PublicMethodsOf } from '@osd/utility-types' ; import { AuditTrailSetup , AuditTrailStart , Auditor } from './types' ; import { AuditTrailService } from './audit_trail_service' ; const createSetupContractMock = ( ) => { const mocked = { register : jest . fn ( ) , } ; return mocked ; } ; const createAuditorMock = ( ) => { const mocked = { add : jest . fn ( ) , withAuditScope : jest . fn ( ) , } ; return mocked ; } ; const createStartContractMock = ( ) => { const mocked = { asScoped : jest . fn ( ) , } ; mocked . asScoped . mockReturnValue ( createAuditorMock ( ) ) ; return mocked ; } ; const createServiceMock = ( ) : jest . Mocked < PublicMethodsOf < AuditTrailService > > => ( { setup : jest . fn ( ) . mockResolvedValue ( createSetupContractMock ( ) ) , start : jest . fn ( ) . mockResolvedValue ( createStartContractMock ( ) ) , stop : jest . fn ( ) , } ) ; export const auditTrailServiceMock = { create : createServiceMock , createSetupContract : createSetupContractMock , createStartContract : createStartContractMock , createAuditorFactory : createStartContractMock , createAuditor : createAuditorMock , } ;