mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
Added Maximum product of 3 numbers in an array
This commit is contained in:
15
Dynamic-Programming/tests/MaxProductOfThree.test.js
Normal file
15
Dynamic-Programming/tests/MaxProductOfThree.test.js
Normal file
@ -0,0 +1,15 @@
|
||||
import { maxProductOfThree } from '../MaxProductOfThree'
|
||||
|
||||
describe('MaxProductOfThree', () => {
|
||||
it('expects to return -1 for array with only 2 numbers', () => {
|
||||
expect(maxProductOfThree([1, 3])).toBe(-1)
|
||||
})
|
||||
|
||||
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)
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user