import { opensearchServiceMock } from '../../opensearch/opensearch_service.mock' ; export const MockLegacyScopedClusterClient = jest . fn ( ) ; export const legacyClusterClientInstanceMock = opensearchServiceMock . createLegacyScopedClusterClient ( ) ; jest . doMock ( '../../opensearch/legacy/scoped_cluster_client' , ( ) => ( { LegacyScopedClusterClient : MockLegacyScopedClusterClient . mockImplementation ( ( ) => legacyClusterClientInstanceMock ) , } ) ) ; jest . doMock ( 'elasticsearch' , ( ) => { const realOpenSearch = jest . requireActual ( 'elasticsearch' ) ; return { ... realOpenSearch , Client : function ( ) { return opensearchServiceMock . createLegacyOpenSearchClient ( ) ; } , } ; } ) ; export const MockOpenSearchClient = jest . fn ( ) ; jest . doMock ( '@elastic/elasticsearch' , ( ) => { const real = jest . requireActual ( '@elastic/elasticsearch' ) ; return { ... real , Client : MockOpenSearchClient , } ; } ) ;