import { applyConfigOverrides } from './apply_config_overrides' ; describe ( 'applyConfigOverrides' , ( ) => { it ( 'overrides `server.uuid` when provided as a command line argument' , ( ) => { const config = { server : { uuid : 'from-config' , } , } ; const argv = [ '--server.uuid' , 'from-argv' ] ; applyConfigOverrides ( config , argv ) ; expect ( config . server . uuid ) . toEqual ( 'from-argv' ) ; } ) ; it ( 'overrides `path.data` when provided as a command line argument' , ( ) => { const config = { path : { data : '/from/config' , } , } ; const argv = [ '--path.data' , '/from/argv' ] ; applyConfigOverrides ( config , argv ) ; expect ( config . path . data ) . toEqual ( '/from/argv' ) ; } ) ; it ( 'properly set the overridden properties even if the parent object is not present in the config' , ( ) => { const config = { } ; const argv = [ '--server.uuid' , 'from-argv' , '--path.data' , '/data-path' ] ; applyConfigOverrides ( config , argv ) ; expect ( config . server . uuid ) . toEqual ( 'from-argv' ) ; expect ( config . path . data ) . toEqual ( '/data-path' ) ; } ) ; } ) ;