Ensure fp.rearg returns a curried function. [closes #2413]

This commit is contained in:
John-David Dalton
2016-06-08 23:55:25 -07:00
parent 5122e9271c
commit 388bf6934d
3 changed files with 31 additions and 0 deletions

View File

@@ -1779,6 +1779,30 @@
/*--------------------------------------------------------------------------*/
QUnit.module('fp.rearg');
(function() {
function fn(a, b, c) {
return [a, b, c];
}
QUnit.test('should be curried', function(assert) {
assert.expect(1);
var rearged = fp.rearg([1, 2, 0])(fn);
assert.deepEqual(rearged('c', 'a', 'b'), ['a', 'b', 'c']);
});
QUnit.test('should curry the rearged function', function(assert) {
assert.expect(1);
var rearged = fp.rearg([1, 2, 0], fn);
assert.deepEqual(rearged('c')('a')('b'), ['a', 'b', 'c']);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('reduce methods');
_.each(['reduce', 'reduceRight'], function(methodName) {