@@ -676,16 +676,14 @@ describe('utils', () => {
676676 delete process . env . BROWSERSTACK_LOCAL ;
677677 } ) ;
678678
679- it ( 'bsconfig connection_settings local_inferred as true if serachforOption returns false with args local-mode true' , ( ) => {
679+ it ( 'bsconfig connection_settings local_inferred as true if args local-mode true' , ( ) => {
680680 let bsConfig = {
681681 connection_settings : {
682682 }
683683 } ;
684684 let args = {
685685 localMode : "always-on"
686686 } ;
687- let searchForOptionStub = sinon . stub ( utils , "searchForOption" ) ;
688- searchForOptionStub . returns ( false ) ;
689687 utils . setLocal ( bsConfig , args ) ;
690688 expect ( bsConfig . connection_settings . local_inferred ) . to . be . eq ( true ) ;
691689 } ) ;
@@ -726,14 +724,13 @@ describe('utils', () => {
726724 expect ( bsConfig . connection_settings . local ) . to . be . eq ( false ) ;
727725 } ) ;
728726
729- it ( 'should change local to true in bsConfig if process.env.BROWSERSTACK_LOCAL is set to true' , ( ) => {
727+ it ( 'should change local to true in bsConfig if args.local is set to true' , ( ) => {
730728 let bsConfig = {
731729 connection_settings : {
732730 local : false ,
733731 } ,
734732 } ;
735- let args = { } ;
736- process . env . BROWSERSTACK_LOCAL = true ;
733+ let args = { local : true } ;
737734 utils . setLocal ( bsConfig , args ) ;
738735 expect ( bsConfig . connection_settings . local ) . to . be . eq ( true ) ;
739736 } ) ;
@@ -748,6 +745,19 @@ describe('utils', () => {
748745 utils . setLocal ( bsConfig , args ) ;
749746 expect ( bsConfig . connection_settings . local ) . to . be . eq ( true ) ;
750747 } ) ;
748+
749+ it ( 'should set local to true in bsConfig if local is passed as string in bsConfig' , ( ) => {
750+ let bsConfig = {
751+ connection_settings : {
752+ local : "true"
753+ } ,
754+ } ;
755+ let args = {
756+ } ;
757+ utils . setLocal ( bsConfig , args ) ;
758+ expect ( bsConfig . connection_settings . local ) . to . be . eq ( true ) ;
759+ } ) ;
760+
751761 } ) ;
752762
753763 describe ( 'setLocalMode' , ( ) => {
@@ -1428,6 +1438,23 @@ describe('utils', () => {
14281438 expect ( utils . isUndefined ( bsConfig . auth ) ) . to . be . true ;
14291439 expect ( utils . isUndefined ( bsConfig . run_settings . npm_dependencies ) ) . to . be . false ;
14301440 } ) ;
1441+
1442+ it ( 'should set connection_settings if bsConfig.connection_settings is undefined' , ( ) => {
1443+ let bsConfig = { run_settings : { } } ;
1444+ utils . setDefaults ( bsConfig , { } ) ;
1445+ expect ( utils . isUndefined ( bsConfig . connection_settings ) ) . to . be . false ;
1446+ } ) ;
1447+
1448+ it ( 'should not set connection_settings if bsConfig.connection_settings is defined ' , ( ) => {
1449+ let bsConfig = {
1450+ run_settings : { } ,
1451+ connection_settings : {
1452+ local : "false"
1453+ }
1454+ } ;
1455+ utils . setDefaults ( bsConfig , { } ) ;
1456+ expect ( bsConfig . connection_settings ) . to . deep . equal ( { local : "false" } ) ;
1457+ } ) ;
14311458 } ) ;
14321459
14331460 describe ( 'getNumberOfSpecFiles' , ( ) => {
0 commit comments