Skip to content

Commit 1847cf3

Browse files
committed
🎨 removed duplicate code
1 parent eb05335 commit 1847cf3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

bin/helpers/utils.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,17 +390,20 @@ exports.setSpecTimeout = (bsConfig, args) => {
390390
logger.debug(`Setting spec timeout = ${specTimeout}`);
391391
}
392392

393-
exports.isValidTimezone = (timezone) => !this.isUndefined(timezone) && !this.isUndefined(TIMEZONE[timezone])
393+
exports.isValidTimezone = (timezone) => this.isNotUndefined(timezone) && this.isNotUndefined(TIMEZONE[timezone])
394394

395395
exports.setTimezone = (bsConfig, args) => {
396396
let timezone = args.timezone || bsConfig.run_settings.timezone;
397-
if(this.isUndefined(timezone) || !this.isValidTimezone(timezone)){
397+
let newTimezone;
398+
if(this.isValidTimezone(timezone)){
399+
newTimezone = timezone;
400+
} else {
398401
logger.error(`Invalid timezone = ${timezone}`);
399402
syncCliLogger.info(chalk.red(Constants.userMessages.INVALID_TIMEZONE));
400403
process.exit(1);
401404
}
402-
bsConfig.run_settings.timezone = timezone;
403-
logger.debug(`Setting timezone = ${timezone}`);
405+
bsConfig.run_settings.timezone = newTimezone;
406+
logger.debug(`Setting timezone = ${newTimezone}`);
404407
}
405408

406409
exports.setRecordFlag = (bsConfig, args) => {

0 commit comments

Comments
 (0)