import { Client } from 'elasticsearch' ; import { IndexStore } from '../../src' ; import { ELASTICSEARCH_HOST , ELASTICSEARCH_API_VERSION } from './config' ; jest . setTimeout ( 10000 ) ; export function makeClient ( ) { return new Client ( { host : ELASTICSEARCH_HOST , log : 'error' , apiVersion : ELASTICSEARCH_API_VERSION , } ) ; } export async function cleanupIndex ( client , index , template ? ) { await client . indices . delete ( { index , requestTimeout : 3000 , } ) . catch ( ( ) => { } ) ; if ( template ) { await client . indices . deleteTemplate ( { name : template , requestTimeout : 3000 , } ) . catch ( ( ) => { } ) ; } } export function cleanupIndexStore ( store ) { return cleanupIndex ( store . client , store . searchIndex ) ; }