import { configureEnvVariables } from '@statechannels/devtools' ; import Knex from 'knex' ; import _ from 'lodash' ; import { DBAdmin } from '../src/db-admin/db-admin' ; configureEnvVariables ( ) ; import { extractDBConfigFromWalletConfig , defaultTestWalletConfig , DatabaseConfiguration , } from '../src/config' ; const constructedKnexs = [ ] ; param databaseConfiguration export const constructKnex = ( databaseConfiguration ) : Knex => { const knex = Knex ( extractDBConfigFromWalletConfig ( defaultTestWalletConfig ( { databaseConfiguration } ) ) ) ; constructedKnexs . push ( knex ) ; return knex ; } ; export let testKnex ; beforeAll ( async ( ) => { testKnex = constructKnex ( { } ) ; await DBAdmin . truncateDataBaseFromKnex ( testKnex ) ; } ) ; afterAll ( async ( ) => { await Promise . all ( constructedKnexs . map ( async ( knex ) => knex . destroy ( ) ) ) ; } ) ;