import getServerPortFromCLIArgs from '../getServerPortFromCLIArgs' ; describe ( 'getServerPortFromCLIArgs' , ( ) => { it ( 'Should parse process.argv and return from there correct port using LONG form of this flag' , ( ) => { process . argv = [ 'node' , 'jest' , '--port' , '3000' ] ; const parsedPort = getServerPortFromCLIArgs ( ) ; expect ( parsedPort ) . toBe ( 3000 ) ; } ) ; it ( 'Should parse process.argv and return from there correct port using SHORT form (-p) of this flag' , ( ) => { process . argv = [ 'node' , 'jest' , '-p' , '3000' ] ; const parsedPort = getServerPortFromCLIArgs ( ) ; expect ( parsedPort ) . toBe ( 3000 ) ; } ) ; it ( 'Should fallback to port 3002 if no args were found in cli args' , ( ) => { process . argv = [ 'node' , 'jest' ] ; const parsedPort = getServerPortFromCLIArgs ( ) ; expect ( parsedPort ) . toBe ( 3002 ) ; } ) ; } ) ;