deno.land / x / rambda@v9.1.1 / source / move.spec.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { move } from './move.js'const list = [ 1, 2, 3, 4 ]
test('happy', () => { const result = move( 0, 1, list )
expect(result).toEqual([ 2, 1, 3, 4 ])})
test('with negative index', () => { const errorMessage = 'Rambda.move does not support negative indexes' expect(() => move( 0, -1, list )).toThrowErrorMatchingInlineSnapshot('"Rambda.move does not support negative indexes"') expect(() => move( -1, 0, list )).toThrowErrorMatchingInlineSnapshot('"Rambda.move does not support negative indexes"')})
test('when indexes are outside the list outbounds', () => { const result1 = move( 10, 1, list ) const result2 = move( 1, 10, list )
expect(result1).toEqual(list) expect(result2).toEqual(list)})
rambda

Version Info

Tagged at
7 months ago