mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
22 lines
663 B
TypeScript
22 lines
663 B
TypeScript
import {removeAtArrayIndex} from 'sentry/utils/removeAtArrayIndex';
|
|
|
|
describe('utils/removeAtArrayIndex', function () {
|
|
it('removes simple value at index', function () {
|
|
const arr = [1, 2, 3];
|
|
expect(removeAtArrayIndex(arr, 1)).toEqual([1, 3]);
|
|
});
|
|
|
|
it('does not mutate array', function () {
|
|
const arr = [1, 2, 3];
|
|
expect(removeAtArrayIndex(arr, 0)).toEqual([2, 3]);
|
|
expect(arr).toEqual([1, 2, 3]);
|
|
});
|
|
|
|
it('removes at boundaries of array', function () {
|
|
const arr = [1, 2, 3];
|
|
expect(removeAtArrayIndex(arr, 0)).toEqual([2, 3]);
|
|
const arr2 = [1, 2, 3];
|
|
expect(removeAtArrayIndex(arr2, 2)).toEqual([1, 2]);
|
|
});
|
|
});
|