Skip to content

Commit 8e41ae4

Browse files
committed
added rspec for utils
1 parent 0d970bb commit 8e41ae4

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

test/unit/bin/helpers/utils.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3148,6 +3148,52 @@ describe('utils', () => {
31483148
});
31493149
});
31503150

3151+
describe('setNetworkLogs', () => {
3152+
it('should return true if networkLogs is passed as boolean true', () => {
3153+
let bsConfig = {
3154+
run_settings: { networkLogs: true }
3155+
};
3156+
let expectResult = {
3157+
run_settings: { networkLogs: 'true' }
3158+
}
3159+
utils.setNetworkLogs(bsConfig);
3160+
expect(bsConfig).to.be.eql(expectResult);
3161+
});
3162+
3163+
it('should return true if networkLogs is passed as string true', () => {
3164+
let bsConfig = {
3165+
run_settings: { networkLogs: "true" }
3166+
};
3167+
let expectResult = {
3168+
run_settings: { networkLogs: "true" }
3169+
}
3170+
utils.setNetworkLogs(bsConfig);
3171+
expect(bsConfig).to.be.eql(expectResult);
3172+
});
3173+
3174+
it('should return false if networkLogs is passed as any other non true value', () => {
3175+
let bsConfig = {
3176+
run_settings: { networkLogs: "abc" }
3177+
};
3178+
let expectResult = {
3179+
run_settings: { networkLogs: "false" }
3180+
}
3181+
utils.setNetworkLogs(bsConfig);
3182+
expect(bsConfig).to.be.eql(expectResult);
3183+
});
3184+
3185+
it('should return false if networkLogs is not passed', () => {
3186+
let bsConfig = {
3187+
run_settings: { }
3188+
};
3189+
let expectResult = {
3190+
run_settings: { networkLogs: "false" }
3191+
}
3192+
utils.setNetworkLogs(bsConfig);
3193+
expect(bsConfig).to.be.eql(expectResult);
3194+
});
3195+
});
3196+
31513197
describe('isSpecTimeoutArgPassed', () => {
31523198
let searchForOptionStub;
31533199
beforeEach(() => {

0 commit comments

Comments
 (0)