Test cleanup and fixes [c-d]

This commit is contained in:
Angelos Chalaris
2018-06-18 16:34:04 +03:00
parent d29974ebc9
commit 105185c213
136 changed files with 805 additions and 484 deletions

View File

@ -5,10 +5,18 @@ const round = require('./round.js');
test('round is a Function', () => {
expect(round).toBeInstanceOf(Function);
});
t.equal(round(1.005, 2), 1.01, "round(1.005, 2) returns 1.01");
t.equal(round(123.3423345345345345344, 11), 123.34233453453, "round(123.3423345345345345344, 11) returns 123.34233453453");
t.equal(round(3.342, 11), 3.342, "round(3.342, 11) returns 3.342");
t.equal(round(1.005), 1, "round(1.005) returns 1");
test('round(1.005, 2) returns 1.01', () => {
expect(round(1.005, 2)).toBe(1.01)
});
test('round(123.3423345345345345344, 11) returns 123.34233453453', () => {
expect(round(123.3423345345345345344, 11)).toBe(123.34233453453)
});
test('round(3.342, 11) returns 3.342', () => {
expect(round(3.342, 11)).toBe(3.342)
});
test('round(1.005) returns 1', () => {
expect(round(1.005)).toBe(1)
});
test('round([1.005, 2]) returns NaN', () => {
expect(isNaN(round([1.005, 2]))).toBeTruthy();
});