import * as test from 'tape' ; import { EventEmitter } from 'events' ; import Conversion from '../src/Conversion' ; import TestSchemaProcessor from './TestModules/TestSchemaProcessor' ; import testSchema from './TestModules/SchemaProcessorTest' ; import testDataContent from './TestModules/DataContentTest' ; import testColumnTypes from './TestModules/ColumnTypesTest' ; /**
 * Runs test suites.
 */ const runTestSuites = ( testSchemaProcessor ) : ( ) => void => { return ( ) => { test . onFinish ( async ( ) => { await testSchemaProcessor . removeTestResources ( ) ; process . exit ( 0 ) ; } ) ; test ( 'Test schema should be created' , ( tapeTestSchema ) => { testSchema ( testSchemaProcessor , tapeTestSchema ) ; } ) ; test ( 'Test the data content' , ( tapeTestDataContent ) => { testDataContent ( testSchemaProcessor , tapeTestDataContent ) ; } ) ; test ( 'Test column types' , ( tapeTestColumnTypes ) => { testColumnTypes ( testSchemaProcessor , tapeTestColumnTypes ) ; } ) ; } ; } ; const testSchemaProcessor = new TestSchemaProcessor ( ) ; testSchemaProcessor . initializeConversion ( ) . then ( ( conversion ) => { ( < EventEmitter > conversion . _eventEmitter ) . on ( conversion . _migrationCompletedEvent , runTestSuites ( testSchemaProcessor ) ) ; return Promise . resolve ( conversion ) ; } ) . then ( testSchemaProcessor . arrangeTestMigration . bind ( testSchemaProcessor ) ) ;