diff --git a/test.js b/test.js index 378bc5a..24e5274 100644 --- a/test.js +++ b/test.js @@ -31,10 +31,14 @@ describe('last', function() { assert.strictEqual(last(['a', 'b', 'c', 'd', 'e', 'f'], 1), 'f'); }); - it('should the last n elements of the array:', function() { + it('should return the last n elements of the array:', function() { assert.deepEqual(last(['a', 'b', 'c', 'd', 'e', 'f'], 3), ['d', 'e', 'f']); }); + it('should not include undefined in the returned elements of the array:', function() { + assert.deepEqual(last(['a', 'b', 'c', 'd', 'e', 'f'], 7), ['a', 'b', 'c', 'd', 'e', 'f']); + }); + it('should return null if the array has no elements', function() { assert.strictEqual(last([]), null); assert.strictEqual(last([], 3), null);