Skip to content

Commit

Permalink
fix(add all tests): all tests for multiply, divide, percent, mod
Browse files Browse the repository at this point in the history
  • Loading branch information
pritam001 committed Mar 1, 2020
1 parent 66f3b4a commit dc41bb0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {

// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: [
"src/*.js"
"dist/*.js"
],

// The directory where Jest should output its coverage files
Expand Down
22 changes: 21 additions & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { plus, minus, multiply, diff, divide, percent } = require('../dist/index.js');
const { plus, minus, multiply, diff, divide, mod, percent } = require('../dist/index.js');

test('adds 1 + 2 to equal 3', () => {
expect(plus(1, 2)).toBe(3);
Expand All @@ -12,3 +12,23 @@ test('diff 10, 2 to equal 8', () => {
expect(diff(10, 2)).toBe(8);
expect(diff(10, 18)).toBe(8);
});

test('multiply 2 and 5 to equal 10', () => {
expect(multiply(2, 5)).toBe(10);
});

test('divide 20 and 5 to equal 4', () => {
expect(divide(20, 5)).toBe(4);
});

test('mod 22 and 5 to equal 2', () => {
expect(mod(22, 5)).toBe(2);
});

test('percent library test', () => {
expect(percent(7, 18, "%", 2)).toBe("38.89%");
expect(percent(19, 12, null, 5)).toBe("158.33333");
expect(percent(7, 10, null, 2)).toBe("70.00");
expect(percent(17, 12, null, null)).toBe("142");
});

0 comments on commit dc41bb0

Please sign in to comment.