Skip to content

Commit 170a49f

Browse files
authored
adding default to connection_settings (#129)
* adding default to connection_settings * removing unwanted file * handle extra case * added object to connection_settings
1 parent 4f7a074 commit 170a49f

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

bin/helpers/utils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ exports.setDefaults = (bsConfig, args) => {
158158
if (bsConfig.run_settings && this.isUndefined(bsConfig.run_settings.npm_dependencies)) {
159159
bsConfig.run_settings.npm_dependencies = {}
160160
}
161+
162+
// setting connection_settings to {} if not present
163+
if (this.isUndefined(bsConfig.connection_settings)) {
164+
bsConfig.connection_settings = {};
165+
}
166+
161167
}
162168

163169
exports.setUsername = (bsConfig, args) => {

test/unit/bin/helpers/utils.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,23 @@ describe('utils', () => {
14281428
expect(utils.isUndefined(bsConfig.auth)).to.be.true;
14291429
expect(utils.isUndefined(bsConfig.run_settings.npm_dependencies)).to.be.false;
14301430
});
1431+
1432+
it ('should set connection_settings if bsConfig.connection_settings is undefined' , () => {
1433+
let bsConfig = { run_settings: {} };
1434+
utils.setDefaults(bsConfig, {});
1435+
expect(utils.isUndefined(bsConfig.connection_settings)).to.be.false;
1436+
});
1437+
1438+
it('should not set connection_settings if bsConfig.connection_settings is defined ', () => {
1439+
let bsConfig = {
1440+
run_settings: {},
1441+
connection_settings: {
1442+
local: "false"
1443+
}
1444+
};
1445+
utils.setDefaults(bsConfig, {});
1446+
expect(bsConfig.connection_settings).to.deep.equal({local: "false"});
1447+
});
14311448
});
14321449

14331450
describe('getNumberOfSpecFiles', () => {

0 commit comments

Comments
 (0)