Skip to content

Commit 2fe2b1d

Browse files
committed
Increase test coverage
1 parent 5612c01 commit 2fe2b1d

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

test/src/util/core/color-test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,27 @@ describe("color", function () {
2222
});
2323
});
2424

25+
describe("when process.stdout is present", function () {
26+
it("should inspect stdout tty state", function () {
27+
const originalProcess = globalThis.process;
28+
29+
try {
30+
globalThis.process = {
31+
stdout: {
32+
isTTY: true,
33+
},
34+
};
35+
36+
const color = new Colorizer();
37+
const actual = color.red("lorem ipsum");
38+
39+
assert.contains(actual, "31m");
40+
} finally {
41+
globalThis.process = originalProcess;
42+
}
43+
});
44+
});
45+
2546
describe("when environment supports color", function () {
2647
let color;
2748

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import referee from "@sinonjs/referee";
2+
import isPropertyConfigurable from "../../../../src/sinon/util/core/is-property-configurable.js";
3+
4+
const assert = referee.assert;
5+
6+
describe("is-property-configurable", function () {
7+
it("returns true when the property is missing", function () {
8+
const actual = isPropertyConfigurable({}, "missing");
9+
10+
assert.isTrue(actual);
11+
});
12+
13+
it("returns false when the property is not configurable", function () {
14+
const object = {};
15+
16+
Object.defineProperty(object, "locked", {
17+
configurable: false,
18+
value: 1,
19+
});
20+
21+
const actual = isPropertyConfigurable(object, "locked");
22+
23+
assert.isFalse(actual);
24+
});
25+
});

0 commit comments

Comments
 (0)