Add tests for “AllWith” fp methods.

This commit is contained in:
John-David Dalton
2016-11-05 16:43:56 -07:00
parent 220713109c
commit b833d83a3e

View File

@@ -801,6 +801,17 @@
assert.deepEqual(objects[0], { 'a': 1 });
assert.deepEqual(actual, { 'a': 1, 'b': 2 });
});
QUnit.test('`fp.' + methodName + '` should work with more than two sources', function(assert) {
assert.expect(2);
var pass = false,
objects = [{ 'a': 1 }, { 'b': 2 }, { 'c': 3 }],
actual = func(function() { pass = true; })(objects);
assert.ok(pass);
assert.deepEqual(actual, { 'a': 1, 'b': 2, 'c': 3 });
});
});
/*--------------------------------------------------------------------------*/
@@ -1518,6 +1529,17 @@
assert.deepEqual(objects[0], { 'a': [1, 2] });
assert.deepEqual(actual, { 'a': [3, 2] });
});
QUnit.test('should work with more than two sources', function(assert) {
assert.expect(2);
var pass = false,
objects = [{ 'a': 1 }, { 'b': 2 }, { 'c': 3 }],
actual = fp.mergeAllWith(function() { pass = true; }, objects);
assert.ok(pass);
assert.deepEqual(actual, { 'a': 1, 'b': 2, 'c': 3 });
});
}());
/*--------------------------------------------------------------------------*/