Skip to content

Commit 2a0451f

Browse files
Added Test cases
1 parent ed24db5 commit 2a0451f

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

test/unit/bin/helpers/capabilityHelper.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,26 @@ describe("capabilityHelper.js", () => {
528528
});
529529
});
530530

531+
it("validate default bsConfig.auth", () => {
532+
bsConfig = {
533+
auth: {
534+
username: "<Your BrowserStack username>",
535+
access_key: "<Your BrowserStack access key>"
536+
}
537+
};
538+
return capabilityHelper
539+
.validate(bsConfig, {parallels: undefined})
540+
.then(function (data) {
541+
chai.assert.fail("Promise error");
542+
})
543+
.catch((error) => {
544+
chai.assert.equal(
545+
error,
546+
Constants.validationMessages.INVALID_DEFAULT_AUTH_PARAMS
547+
);
548+
});
549+
});
550+
531551
it("validate bsConfig.browsers", () => {
532552
let bsConfig = {
533553
auth: {},

test/unit/bin/helpers/utils.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ describe("utils", () => {
2626
expect(utils.getErrorCodeFromMsg(constant.validationMessages.EMPTY_BROWSER_LIST)).to.eq("bstack_json_invalid_no_browsers");
2727
expect(utils.getErrorCodeFromMsg(constant.validationMessages.EMPTY_RUN_SETTINGS)).to.eq("bstack_json_invalid_no_run_settings");
2828
expect(utils.getErrorCodeFromMsg(constant.validationMessages.EMPTY_SPEC_FILES)).to.eq("bstack_json_invalid_values");
29+
expect(utils.getErrorCodeFromMsg(constant.validationMessages.INVALID_DEFAULT_AUTH_PARAMS)).to.eq("bstack_json_default_auth_keys");
30+
expect(utils.getErrorCodeFromMsg(constant.validationMessages.INVALID_PARALLELS_CONFIGURATION)).to.eq("invalid_parallels_specified");
31+
expect(utils.getErrorCodeFromMsg(constant.validationMessages.LOCAL_NOT_SET)).to.eq("cypress_json_base_url_no_local");
32+
expect(utils.getErrorCodeFromMsg(constant.validationMessages.INCORRECT_DIRECTORY_STRUCTURE)).to.eq("invalid_directory_structure");
33+
expect(utils.getErrorCodeFromMsg("Please use --config-file <path to browserstack.json>.")).to.eq("bstack_json_path_invalid");
2934
});
3035
});
3136

0 commit comments

Comments
 (0)