Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
],
"coverageThreshold": {
"global": {
"lines": 80,
"branches": 80,
"functions": 80,
"statements": 80
"lines": 90,
"branches": 90,
"functions": 90,
"statements": 90
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/__tests__/app.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const { getCurrentMonth } = require("../app");
const { isAdmin } = require("../app");

jest
.useFakeTimers()
.setSystemTime(new Date('2020-01-01'));
jest.useFakeTimers().setSystemTime(new Date("2020-01-01"));

describe("app tests suites - getCurrentMonth", () => {
test("should return the current month", () => {
Expand Down
23 changes: 23 additions & 0 deletions src/services/__tests__/excludeNamesWithX.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const excludeNamesWithX = require("../excludeNamesWithX");

describe("excludeNamesWithX tests suites", () => {
it("should return array", () => {
const result = excludeNamesWithX([]);
expect(result).toEqual([]);
});

it('should return an array with all names as no names have an "x" letter', () => {
const result = excludeNamesWithX(["Momo", "Hadji", "Leo"]);
expect(result).toEqual(["Momo", "Hadji", "Leo"]);
});

it('should return an array with JeanKevin only as it is the only name without the letter "x" ', () => {
const result = excludeNamesWithX(["DMX", "Xzibit", "JeanKevin"]);
expect(result).toEqual(["JeanKevin"]);
});

it('should return an array with JC and Leo only as only xena contains the letter "x" ', () => {
const result = excludeNamesWithX(["JC", "Leo", "xena"]);
expect(result).toEqual(["JC", "Leo"]);
});
});
2 changes: 2 additions & 0 deletions src/services/excludeNamesWithX.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module.exports = (names) =>
names.filter((name) => name.toLowerCase().indexOf("x") === -1);