deno.land / x / rambda@v9.1.1 / source / move.spec.js
123456789101112131415161718192021222324252627282930313233import { 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)})
Version Info