Skip to content

Commit

Permalink
chore(fix): increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
YvesIraguha committed May 7, 2019
1 parent 3b01993 commit be402a4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
25 changes: 25 additions & 0 deletions src/__tests__/__utils__/validator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,35 @@ describe("Validator Class", () => {
password: "Password is required"
});
});

it("should validate matching of two values", () => {
expect(Validator.isMatch("password", "1234", "1234ad")).toEqual({
message: "Your passwords do not match!"
});
expect(Validator.isMatch("password", "1234", "1234")).toEqual({});
});

it("should validate new article", () => {
expect(
Validator.newArticleValidation({
title: "hello",
body: "hello world",
description: "hello world"
})
).toEqual("Title should be more than 10 characters long");
expect(
Validator.newArticleValidation({
title: "hello world",
body: "hello world",
description: "hello"
})
).toEqual("Description should be more than 10 characters long");
expect(
Validator.newArticleValidation({
title: "hello world",
body: "hello world",
description: "hello world"
})
).toEqual("Body should be more than 100 words");
});
});
1 change: 0 additions & 1 deletion src/views/CreateEditHolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ Article.propTypes = {
body: PropTypes.string.isRequired,
message: PropTypes.string,
response: PropTypes.object,
articleError: PropTypes.string,
description: PropTypes.string,
tagsList: PropTypes.arrayOf(PropTypes.string)
}).isRequired,
Expand Down

0 comments on commit be402a4

Please sign in to comment.