Skip to content

Commit

Permalink
add tests for remove out of bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
mo-ba committed Sep 5, 2023
1 parent eed37ea commit 0fcfe30
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/core/array/operator/remove.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ describe('remove', () => {
expect(array).to.eql([1,2,3]);
});

it('should remove out of bounds', () => {
const array = [1,2,3];
const fn = remove(3);
expect(() => fn(fn(array))).to.throw(`index: (3) out of range`);
});

it('should remove negative index', () => {
const array = [1,2,3];
const fn = remove(-1);
expect(() => fn(fn(array))).to.throw(`index: (-1) out of range`);
});


it('should throw if null or undefined', () => {
const fn = remove(2);
Expand Down

0 comments on commit 0fcfe30

Please sign in to comment.