import test from 'unit.js' ; import { ConnectionManager } from '../connection' ; const TEST_REPOSITORY_NAME = 'test-repository' ; const manager = new ConnectionManager ( TEST_REPOSITORY_NAME ) ; describe ( 'Test Connections' , ( ) => { it ( 'Create R/W Connection' , async ( ) => { const rw = await manager . connect ( 'rw' ) ; test . value ( rw . name ) . startsWith ( `${ TEST_REPOSITORY_NAME }-rw` ) ; test . value ( rw . isConnected ) . is ( true ) ; await manager . disconnect ( 'rw' ) ; test . value ( rw . isConnected ) . is ( false ) ; } ) ; it ( 'Create R/O Connection' , async ( ) => { const ro = await manager . connect ( 'ro' ) ; test . value ( ro . name ) . startsWith ( `${ TEST_REPOSITORY_NAME }-ro` ) ; test . value ( ro . isConnected ) . is ( true ) ; await manager . disconnect ( 'ro' ) ; test . value ( ro . isConnected ) . is ( false ) ; } ) ; } ) ;