diff --git a/src/index.test.js b/src/index.test.js index b584552..99b1268 100644 --- a/src/index.test.js +++ b/src/index.test.js @@ -1,11 +1,6 @@ -const Gradient = require("./index"); +const colorGradient = require("./index"); const expect = require("chai").expect; -const colorGradient = new Gradient(); -const firstColor = "#3F2CAF"; -const secondColor = "#8BC2E3"; -const numberProps = 10; - describe("javascript-color-gradient", function () { describe("getArray", function () { it("should return an array of strings", function () { @@ -21,7 +16,7 @@ describe("javascript-color-gradient", function () { describe("setGradient", function () { it("type should be an object", function () { - expect(colorGradient.setGradient(firstColor, secondColor)).to.satisfy( + expect(colorGradient.setGradient("#3F2CAF", "#8BC2E3")).to.satisfy( isObject ); @@ -31,12 +26,22 @@ describe("javascript-color-gradient", function () { }); }); + describe("getArray", function () { + it("array length should be 10", function () { + expect(colorGradient.getArray("#3F2CAF", "#8BC2E3")).to.satisfy(isArray); + + function isArray(object) { + return object.length === 10; + } + }); + }); + describe("getColor", function () { - it("should start with #", function () { - expect(colorGradient.getColor(numberProps)).to.satisfy(isNumber); + it("should be equal to #8bc2e3", function () { + expect(colorGradient.getColor(10)).to.satisfy(isEqual); - function isNumber(item) { - return item.startsWith("#"); + function isEqual(item) { + return item === "#8bc2e3"; } }); });