Skip to content

Commit

Permalink
test(head): add spec for optional n elements parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbayley committed Apr 8, 2024
1 parent 2946b98 commit e014ed8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/head.spec.js
Expand Up @@ -10,6 +10,10 @@ describe('head', () => {
expect(head(array)).toBe(1);
});

it('should return the first n elements', () => {
expect(head(array, 2)).toEqual([1, 2]);
});

it('should return `undefined` when querying empty arrays', () => {
arrayProto[0] = 1;
expect(head([])).toBe(undefined);
Expand Down

0 comments on commit e014ed8

Please sign in to comment.