2021-10-14 21:10:34 +05:30
|
|
|
import { maxProductOfThree } from '../MaxProductOfThree'
|
|
|
|
|
|
|
|
|
|
describe('MaxProductOfThree', () => {
|
2021-10-15 21:49:29 +05:30
|
|
|
it('expects to throw error for array with only 2 numbers', () => {
|
|
|
|
|
expect(() => {
|
|
|
|
|
maxProductOfThree([1, 3])
|
|
|
|
|
}).toThrow('Triplet cannot exist with the given array')
|
2021-10-14 21:10:34 +05:30
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('expects to return 300 as the maximum product', () => {
|
|
|
|
|
expect(maxProductOfThree([10, 6, 5, 3, 1, -10])).toBe(300)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('expects to return 300 as the maximum product', () => {
|
|
|
|
|
expect(maxProductOfThree([10, -6, 5, 3, 1, -10])).toBe(600)
|
|
|
|
|
})
|
|
|
|
|
})
|