From fc369c3448249b13cfd499cf2bc17e4434ea9516 Mon Sep 17 00:00:00 2001 From: jdalton Date: Mon, 9 Feb 2015 08:39:09 -0800 Subject: [PATCH] Add `_.fill` and `_.slice` tests for default `start` and `end` params. --- test/test.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index ec4245a67..d70b42850 100644 --- a/test/test.js +++ b/test/test.js @@ -4059,6 +4059,19 @@ QUnit.module('lodash.fill'); (function() { + test('should use a default `start` of `0` and a default `end` of `array.length`', 1, function() { + var array = [1, 2, 3]; + deepEqual(_.fill(array, 'a'), ['a', 'a', 'a']); + }); + + test('should use `undefined` for `value` if not provided', 2, function() { + var array = [1, 2, 3], + actual = _.fill(array); + + deepEqual(actual, [undefined, undefined, undefined]); + ok(_.every(actual, function(value, index) { return index in actual; })); + }); + test('should work with a positive `start`', 1, function() { var array = [1, 2, 3]; deepEqual(_.fill(array, 'a', 1), [1, 'a', 'a']); @@ -11930,6 +11943,12 @@ (function() { var array = [1, 2, 3]; + test('should use a default `start` of `0` and a default `end` of `array.length`', 2, function() { + var actual = _.slice(array); + deepEqual(actual, array); + notStrictEqual(actual, array); + }); + test('should work with a positive `start`', 1, function() { deepEqual(_.slice(array, 1), [2, 3]); }); @@ -12013,7 +12032,7 @@ actual = _.map(array, _.slice); deepEqual(actual, array); - notStrictEqual(actual, array) + notStrictEqual(actual, array); }); test('should work in a lazy chain sequence', 12, function() {