Skip to content

Commit d022d2a

Browse files
authored
compare to a fractional number
Otherwise `5.111111111` will not be equals to `5.11` and the same for `5.222222222`
1 parent 0f94b74 commit d022d2a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/functions-and-arrays.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ describe('Bonus: Calculate the average of a mixed elements array', () => {
175175

176176
it('should return the average of the array', () => {
177177
// false is counted as 0
178-
expect(avg([6, 12, 'miami', 1, 'barca', '200', 'lisboa', 8, false])).toBe(5.11);
178+
expect(avg([6, 12, 'miami', 1, 'barca', '200', 'lisboa', 8, false])).toBe(46/9);
179179
// true is counted as 1
180-
expect(avg([6, 12, 'miami', 1, 'barca', '200', 'lisboa', 8, true])).toBe(5.22);
180+
expect(avg([6, 12, 'miami', 1, 'barca', '200', 'lisboa', 8, true])).toBe(47/9);
181181
});
182182
});
183183

0 commit comments

Comments
 (0)