import { PublicMethodsOf } from '@osd/utility-types' ; import { BehaviorSubject } from 'rxjs' ; import { CoreUsageDataService } from './core_usage_data_service' ; import { CoreUsageData , CoreUsageDataStart } from './types' ; const createStartContractMock = ( ) => { const startContract = { getCoreUsageData : jest . fn ( ) . mockResolvedValue ( new BehaviorSubject < CoreUsageData > ( { config : { opensearch : { apiVersion : 'master' , customHeadersConfigured : false , healthCheckDelayMs : 2500 , logQueries : false , numberOfHostsConfigured : 1 , pingTimeoutMs : 30000 , requestHeadersWhitelistConfigured : false , requestTimeoutMs : 30000 , shardTimeoutMs : 30000 , sniffIntervalMs : - 1 , sniffOnConnectionFault : false , sniffOnStart : false , ssl : { alwaysPresentCertificate : false , certificateAuthoritiesConfigured : false , certificateConfigured : false , keyConfigured : false , verificationMode : 'full' , keystoreConfigured : false , truststoreConfigured : false , } , } , http : { basePathConfigured : false , compression : { enabled : true , referrerWhitelistConfigured : false , } , keepaliveTimeout : 120000 , maxPayloadInBytes : 1048576 , requestId : { allowFromAnyIp : false , ipAllowlistConfigured : false , } , rewriteBasePath : false , socketTimeout : 120000 , ssl : { certificateAuthoritiesConfigured : false , certificateConfigured : false , cipherSuites : [ 'ECDHE-RSA-AES128-GCM-SHA256' , 'ECDHE-ECDSA-AES128-GCM-SHA256' , 'ECDHE-RSA-AES256-GCM-SHA384' , 'ECDHE-ECDSA-AES256-GCM-SHA384' , 'DHE-RSA-AES128-GCM-SHA256' , 'ECDHE-RSA-AES128-SHA256' , 'DHE-RSA-AES128-SHA256' , 'ECDHE-RSA-AES256-SHA384' , 'DHE-RSA-AES256-SHA384' , 'ECDHE-RSA-AES256-SHA256' , 'DHE-RSA-AES256-SHA256' , 'HIGH' , '!aNULL' , '!eNULL' , '!EXPORT' , '!DES' , '!RC4' , '!MD5' , '!PSK' , '!SRP' , '!CAMELLIA' , ] , clientAuthentication : 'none' , keyConfigured : false , keystoreConfigured : false , redirectHttpFromPortConfigured : false , supportedProtocols : [ 'TLSv1.1' , 'TLSv1.2' ] , truststoreConfigured : false , } , xsrf : { disableProtection : false , whitelistConfigured : false , } , } , logging : { appendersTypesUsed : [ ] , loggersConfiguredCount : 0 , } , savedObjects : { maxImportExportSizeBytes : 10000 , maxImportPayloadBytes : 26214400 , } , } , environment : { memory : { heapSizeLimit : 1 , heapTotalBytes : 1 , heapUsedBytes : 1 , } , } , services : { savedObjects : { indices : [ { docsCount : 1 , docsDeleted : 1 , alias : 'test_index' , primaryStoreSizeBytes : 1 , storeSizeBytes : 1 , } , ] , } , } , } ) ) , } ; return startContract ; } ; const createMock = ( ) => { const mocked = { setup : jest . fn ( ) , start : jest . fn ( ) . mockReturnValue ( createStartContractMock ( ) ) , stop : jest . fn ( ) , } ; return mocked ; } ; export const coreUsageDataServiceMock = { create : createMock , createStartContract : createStartContractMock , } ;