import { expect } from 'chai' ; import { GenericHandlerAdapter } from '../../../../lib/dispatcher/request/handler/GenericHandlerAdapter' ; import { MockAlwaysFalseRequestHandler } from '../../../mocks/request/MockAlwaysFalseRequestHandler' ; import { MockAlwaysTrueRequestHandler } from '../../../mocks/request/MockAlwaysTrueRequestHandler' ; describe ( 'GenericHandlerAdapter' , ( ) => { const handlerAdapter = new GenericHandlerAdapter ( ) ; it ( 'should be able to check for supported handler object' , ( ) => { expect ( handlerAdapter . supports ( new MockAlwaysTrueRequestHandler ( ) ) ) . eq ( true ) ; expect ( handlerAdapter . supports ( new MockAlwaysFalseRequestHandler ( ) ) ) . eq ( true ) ; expect ( handlerAdapter . supports ( { canHandle : true , handle : true } ) ) . equal ( false ) ; } ) ; it ( 'should be able to invoke the execute function on supported handler object' , async ( ) => { const response = await handlerAdapter . execute ( 'test' , new MockAlwaysTrueRequestHandler ( ) ) ; expect ( response ) . eq ( 'Input(test) received at MockAlwaysTrueRequestHandler' ) ; } ) ; } ) ;