Skip to content

Commit 5dca089

Browse files
committed
Add test case when the array length is less than 3
1 parent e47609d commit 5dca089

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/_Problems_/max-product-of-3-numbers/max-product-of-3-numbers.test.js

+6
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,10 @@ describe("Maximum Product of three numbers", () => {
3030
expect(maxProductof3Numbers(largeArray)).toEqual(100 * 100 * 100);
3131
expect(maxProductof3NumbersII(largeArray)).toEqual(100 * 100 * 100);
3232
});
33+
34+
it("returns an error if there are less than 3 numbers", () => {
35+
expect(() => {
36+
maxProductof3Numbers([-10, -1]);
37+
}).toThrowError();
38+
});
3339
});

0 commit comments

Comments
 (0)