Skip to content

Commit 9ea6b81

Browse files
committed
test: add case to verify calculateMean throws error for empty array
1 parent 7f9881d commit 9ea6b81

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ test("handles negative and decimal numbers", () => {
3535
expects(calculateMean([-2, 4, 3.5])).toBeCloseTo(1.8333);
3636
});
3737

38-
test
38+
test("throws for an empty array", () => {
39+
expect(() => calculateMean([])).toThrow(
40+
new Error("calculateMean requires a non-empty array")
41+
);
42+
});
3943
// Given an array with a single number
4044
// When passed to calculateMean
4145
// Then it should return that number

0 commit comments

Comments
 (0)