Skip to content

Commit 48a0d2c

Browse files
committed
added specs for the changes
1 parent c096e3c commit 48a0d2c

File tree

5 files changed

+48
-7
lines changed

5 files changed

+48
-7
lines changed

bin/helpers/sync/failedSpecsDetails.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ let getSpecStatus = (specStatus) => {
8383
case 'passed_with_pending':
8484
case 'skipped':
8585
case 'passed_with_skipped': return chalk.blueBright(specStatus);
86-
default: chalk.yellow(specStatus);
86+
default: return chalk.yellow(specStatus);
8787
}
8888
}
8989

9090
exports.failedSpecsDetails = failedSpecsDetails;
91+
exports.getSpecStatus = getSpecStatus;

test/unit/bin/helpers/packageInstaller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ describe("packageInstaller", () => {
256256
})
257257
.catch((error) => {
258258
spawnStub.restore();
259-
chai.assert.equal(error, "Packages were not installed successfully. Error code 1")
259+
chai.assert.equal(error, "Packages were not installed successfully. Error code ${code}")
260260
});
261261
});
262262
});

test/unit/bin/helpers/sync/failedSpecDetails.js

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use strict';
22
const chai = require("chai"),
33
expect = chai.expect,
4-
chaiAsPromised = require("chai-as-promised");
4+
chaiAsPromised = require("chai-as-promised"),
5+
chalk = require('chalk');
56

67
const sinon = require("sinon");
78
chai.use(chaiAsPromised);
@@ -74,3 +75,42 @@ describe("failedSpecsDetails", () => {
7475
});
7576
});
7677
});
78+
79+
describe("#getSpecStatus", () => {
80+
81+
it("returns failed in red if specStatus is failed", () => {
82+
let specStatus = "failed";
83+
let response = chalk.red(specStatus);
84+
expect(specDetails.getSpecStatus(specStatus)).to.eq(response);
85+
});
86+
87+
it("returns passed_with_skipped in blueBright if specStatus is passed_with_skipped", () => {
88+
let specStatus = "passed_with_skipped";
89+
let response = chalk.blueBright(specStatus);
90+
expect(specDetails.getSpecStatus(specStatus)).to.eq(response);
91+
});
92+
93+
it("returns pending in blueBright if specStatus is pending", () => {
94+
let specStatus = "pending";
95+
let response = chalk.blueBright(specStatus);
96+
expect(specDetails.getSpecStatus(specStatus)).to.eq(response);
97+
});
98+
99+
it("returns passed_with_pending in blueBright if specStatus is passed_with_pending", () => {
100+
let specStatus = "passed_with_pending";
101+
let response = chalk.blueBright(specStatus);
102+
expect(specDetails.getSpecStatus(specStatus)).to.eq(response);
103+
});
104+
105+
it("returns skipped in blueBright if specStatus is skipped", () => {
106+
let specStatus = "skipped";
107+
let response = chalk.blueBright(specStatus);
108+
expect(specDetails.getSpecStatus(specStatus)).to.eq(response);
109+
});
110+
111+
it("returns other statuses in yellow if specStatus is other than something known", () => {
112+
let specStatus = "xyz";
113+
let response = chalk.yellow(specStatus);
114+
expect(specDetails.getSpecStatus(specStatus)).to.eq(response);
115+
});
116+
});

test/unit/bin/helpers/sync/specSummary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe("printSpecsRunSummary", () => {
4646
var loggerInfoSpy = sinon.spy(logger, 'info');
4747

4848
specSummary.printSpecsRunSummary(data, machines);
49-
sinon.assert.calledWith(loggerInfoSpy, 'Total tests: 4, passed: 1, failed: 2, skipped: 1');
49+
sinon.assert.calledWith(loggerInfoSpy, 'Total tests: 4, passed: 1, failed: 2, skipped: 1, pending: 0');
5050
sinon.assert.calledWith(loggerInfoSpy, `Done in ${time / 1000} seconds using ${machines} machines\n`);
5151

5252
loggerInfoSpy.restore();

test/unit/bin/helpers/sync/syncSpecsLogs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ describe("syncSpecsLogs", () => {
136136
const stream = sandbox.stub();
137137
stream.write = sandbox.stub();
138138
syncSpecsLogs.__set__('stream', stream);
139-
let combination = "Windows 10", path = "path", status = "passed";
140-
writeToTable(combination, path, status);
141-
sinon.assert.calledOnceWithExactly(stream.write, [combination , ":", `${path} ${status}`]);
139+
let combination = "Windows 10", path = "path", status = "passed", statusMark = "passed";
140+
writeToTable(combination, path, status, statusMark);
141+
sinon.assert.calledOnceWithExactly(stream.write, [combination , ":", `${path} ${statusMark} [${status}]`]);
142142
});
143143
});
144144

0 commit comments

Comments
 (0)