mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 15:07:13 +01:00
add array test
This commit is contained in:
13
helpers/array.test.js
Normal file
13
helpers/array.test.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { getNextSmaller, getNextBigger } from './array'
|
||||||
|
|
||||||
|
test('getPreviousInOrder', () => {
|
||||||
|
const result = getNextSmaller([3, 1, 2, 0, 8, 9, 10], 5)
|
||||||
|
|
||||||
|
expect(result).toEqual(3)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('getNextInOrder', () => {
|
||||||
|
const result = getNextBigger([7, 8, 9, 3, 1, 2], 4)
|
||||||
|
|
||||||
|
expect(result).toEqual(7)
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user