import { ConfigIntelServer } from '@dripjs/types' ; import { WsArgumentsHost } from '@nestjs/common/interfaces' ; const config = require ( 'config' ) . container . intelService ; export function getSwitchToWs ( params ) { let un = config . username ; let pwd = config . password ; if ( params . noUsername ) { un = undefined ; } else if ( params . username ) { un = params . username ; } if ( params . noPassword ) { pwd = undefined ; } else if ( params . password ) { pwd = params . password ; } return jest . fn ( ( ) => { return < WsArgumentsHost > { getClient : ( ) => { return { handshake : { headers : { username : un , password : pwd , } , } , } ; } , } ; } ) ; }