Skip to content

Commit 4312a67

Browse files
committed
change floating point testing to .toBeCloseTo
1 parent cba37a9 commit 4312a67

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎Sprint-1/implement/sum.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ test("given an array containing negative numbers, returns the correct total sum"
3535
// When passed to the sum function
3636
// Then it should return the correct total sum
3737
test("given an array with decimal/float numbers, returns the correct total sum", () => {
38-
expect(sum([1.5, 2.5, 3.5])).toEqual(7.5);
39-
expect(sum([-1.5, -2.5, -3.5])).toEqual(-7.5);
38+
expect(sum([1.5, 2.5, 3.5])).toBeCloseTo(7.5);
39+
expect(sum([-1.5, -2.5, -3.5])).toBeCloseTo(-7.5); // Using toBeCloseTo for floating point precision
4040
});
4141

4242
// Given an array containing non-number values

0 commit comments

Comments
 (0)