Skip to content

Commit 1d79fb9

Browse files
committed
cleanup, add additional tests
1 parent aa98860 commit 1d79fb9

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/index.test.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
const Gradient = require("./index");
1+
const colorGradient = require("./index");
22
const expect = require("chai").expect;
33

4-
const colorGradient = new Gradient();
5-
const firstColor = "#3F2CAF";
6-
const secondColor = "#8BC2E3";
7-
const numberProps = 10;
8-
94
describe("javascript-color-gradient", function () {
105
describe("getArray", function () {
116
it("should return an array of strings", function () {
@@ -21,7 +16,7 @@ describe("javascript-color-gradient", function () {
2116

2217
describe("setGradient", function () {
2318
it("type should be an object", function () {
24-
expect(colorGradient.setGradient(firstColor, secondColor)).to.satisfy(
19+
expect(colorGradient.setGradient("#3F2CAF", "#8BC2E3")).to.satisfy(
2520
isObject
2621
);
2722

@@ -31,12 +26,22 @@ describe("javascript-color-gradient", function () {
3126
});
3227
});
3328

29+
describe("getArray", function () {
30+
it("array length should be 10", function () {
31+
expect(colorGradient.getArray("#3F2CAF", "#8BC2E3")).to.satisfy(isArray);
32+
33+
function isArray(object) {
34+
return object.length === 10;
35+
}
36+
});
37+
});
38+
3439
describe("getColor", function () {
35-
it("should start with #", function () {
36-
expect(colorGradient.getColor(numberProps)).to.satisfy(isNumber);
40+
it("should be equal to #8bc2e3", function () {
41+
expect(colorGradient.getColor(10)).to.satisfy(isEqual);
3742

38-
function isNumber(item) {
39-
return item.startsWith("#");
43+
function isEqual(item) {
44+
return item === "#8bc2e3";
4045
}
4146
});
4247
});

0 commit comments

Comments
 (0)