Skip to content

Commit

Permalink
cleanup, add additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrinlol committed Feb 9, 2022
1 parent aa98860 commit 1d79fb9
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/index.test.js
Original file line number Diff line number Diff line change
@@ -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 () {
Expand All @@ -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
);

Expand All @@ -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";
}
});
});
Expand Down

0 comments on commit 1d79fb9

Please sign in to comment.