File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -404,7 +404,7 @@ exports.isValidTimezone = (timezone) => {
404404exports . setTimezone = ( bsConfig , args ) => {
405405 let timezone = undefined ;
406406 if ( this . isTimezoneArgPassed ( ) ) {
407- if ( ! this . isUndefined ( args . timezone ) ) {
407+ if ( this . isNotUndefined ( args . timezone ) ) {
408408 if ( this . isValidTimezone ( args . timezone ) ) {
409409 timezone = args . timezone ;
410410 } else {
@@ -413,7 +413,7 @@ exports.setTimezone = (bsConfig, args) => {
413413 process . exit ( 1 ) ;
414414 }
415415 }
416- } else if ( ! this . isUndefined ( bsConfig . run_settings . timezone ) ) {
416+ } else if ( this . isNotUndefined ( bsConfig . run_settings . timezone ) ) {
417417 if ( this . isValidTimezone ( bsConfig . run_settings . timezone ) ) {
418418 timezone = bsConfig . run_settings . timezone ;
419419 } else {
@@ -591,6 +591,8 @@ exports.fixCommaSeparatedString = (string) => {
591591
592592exports . isUndefined = value => ( value === undefined || value === null ) ;
593593
594+ exports . isNotUndefined = value => ! this . isUndefined ( value ) ;
595+
594596exports . isPositiveInteger = ( str ) => {
595597 if ( typeof str !== 'string' ) {
596598 return false ;
Original file line number Diff line number Diff line change @@ -192,6 +192,20 @@ describe('utils', () => {
192192 } ) ;
193193 } ) ;
194194
195+ describe ( 'isNotUndefined' , ( ) => {
196+ it ( 'should return false for a undefined value' , ( ) => {
197+ expect ( utils . isNotUndefined ( undefined ) ) . to . be . equal ( false ) ;
198+ expect ( utils . isNotUndefined ( null ) ) . to . be . equal ( false ) ;
199+ } ) ;
200+
201+ it ( 'should return true for a defined value' , ( ) => {
202+ expect ( utils . isNotUndefined ( 1.234 ) ) . to . be . equal ( true ) ;
203+ expect ( utils . isNotUndefined ( '1.234' ) ) . to . be . equal ( true ) ;
204+ expect ( utils . isNotUndefined ( 100 ) ) . to . be . equal ( true ) ;
205+ expect ( utils . isNotUndefined ( - 1 ) ) . to . be . equal ( true ) ;
206+ } ) ;
207+ } ) ;
208+
195209 describe ( 'setParallels' , ( ) => {
196210 var sandbox ;
197211 beforeEach ( ( ) => {
You can’t perform that action at this time.
0 commit comments