mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Add more test coverage to _.add, _.subtract, and _.transform.
This commit is contained in:
31
test/test.js
31
test/test.js
@@ -926,6 +926,14 @@
|
|||||||
assert.strictEqual(_.add('x', 'y'), 'xy');
|
assert.strictEqual(_.add('x', 'y'), 'xy');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('should work with only an `augend` or `addend`', function(assert) {
|
||||||
|
assert.expect(3);
|
||||||
|
|
||||||
|
assert.strictEqual(_.add(6), 6);
|
||||||
|
assert.strictEqual(_.add(6, undefined), 6);
|
||||||
|
assert.strictEqual(_.add(undefined, 4), 4);
|
||||||
|
});
|
||||||
|
|
||||||
QUnit.test('should return an unwrapped value when implicitly chaining', function(assert) {
|
QUnit.test('should return an unwrapped value when implicitly chaining', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
@@ -17996,6 +18004,14 @@
|
|||||||
assert.deepEqual(_.subtract('x', 'y'), NaN);
|
assert.deepEqual(_.subtract('x', 'y'), NaN);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('should work with only a `minuend` or `subtrahend`', function(assert) {
|
||||||
|
assert.expect(3);
|
||||||
|
|
||||||
|
assert.strictEqual(_.subtract(6), 6);
|
||||||
|
assert.strictEqual(_.subtract(6, undefined), 6);
|
||||||
|
assert.strictEqual(_.subtract(undefined, 4), 4);
|
||||||
|
});
|
||||||
|
|
||||||
QUnit.test('should return an unwrapped value when implicitly chaining', function(assert) {
|
QUnit.test('should return an unwrapped value when implicitly chaining', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
@@ -20357,6 +20373,21 @@
|
|||||||
assert.deepEqual(actual, expected);
|
assert.deepEqual(actual, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('should create regular arrays from typed arrays', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
var expected = lodashStable.map(typedArrays, lodashStable.constant(true));
|
||||||
|
|
||||||
|
var actual = lodashStable.map(typedArrays, function(type) {
|
||||||
|
var Ctor = root[type],
|
||||||
|
array = Ctor ? new Ctor(new ArrayBuffer(24)) : [];
|
||||||
|
|
||||||
|
return lodashStable.isArray(_.transform(array, noop));
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual(actual, expected);
|
||||||
|
});
|
||||||
|
|
||||||
QUnit.test('should support an `accumulator` value', function(assert) {
|
QUnit.test('should support an `accumulator` value', function(assert) {
|
||||||
assert.expect(4);
|
assert.expect(4);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user