mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 08:16:50 +08:00
merge: Add FindMin (#849)
This commit is contained in:
18
Maths/test/FindMin.test.js
Normal file
18
Maths/test/FindMin.test.js
Normal file
@ -0,0 +1,18 @@
|
||||
import { findMin } from '../FindMin'
|
||||
|
||||
describe('FindMin', () => {
|
||||
test('Should return the minimum number in the array', () => {
|
||||
const min = findMin(2, 5, 1, 12, 43, 1, 9)
|
||||
expect(min).toBe(1)
|
||||
})
|
||||
|
||||
test('Should return the minimum number in the array', () => {
|
||||
const min = findMin(21, 513, 6)
|
||||
expect(min).toBe(6)
|
||||
})
|
||||
|
||||
test('Should throw error', () => {
|
||||
const min = () => findMin()
|
||||
expect(min).toThrow('Array is empty')
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user