mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Add _.flow and _.flowRight tests for curried functions with placeholders.
This commit is contained in:
16
test/test.js
16
test/test.js
@@ -2301,6 +2301,18 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('`_.' + methodName + '` should work with curried functions with placeholders', 1, function() {
|
||||||
|
var curried = _.curry(_.pluck),
|
||||||
|
getProp = curried(curried.placeholder, 'a'),
|
||||||
|
objects = [{ 'a': 1 }, { 'a': 2 }, { 'a': 1 }];
|
||||||
|
|
||||||
|
var combined = isFlow
|
||||||
|
? func(getProp, _.uniq)
|
||||||
|
: func(_.uniq, getProp);
|
||||||
|
|
||||||
|
deepEqual(combined(objects), [1, 2]);
|
||||||
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should return a wrapped value when chaining', 1, function() {
|
test('`_.' + methodName + '` should return a wrapped value when chaining', 1, function() {
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
var wrapped = _(_.noop)[methodName]();
|
var wrapped = _(_.noop)[methodName]();
|
||||||
@@ -11662,7 +11674,7 @@
|
|||||||
strictEqual(par3(), isPartial ? 'hi pebbles' : 'pebbles hi');
|
strictEqual(par3(), isPartial ? 'hi pebbles' : 'pebbles hi');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should work with curried methods', 2, function() {
|
test('`_.' + methodName + '` should work with curried functions', 2, function() {
|
||||||
var fn = function(a, b, c) { return a + b + c; },
|
var fn = function(a, b, c) { return a + b + c; },
|
||||||
curried = _.curry(func(fn, 1), 2);
|
curried = _.curry(func(fn, 1), 2);
|
||||||
|
|
||||||
@@ -11670,7 +11682,7 @@
|
|||||||
strictEqual(curried(2)(3), 6);
|
strictEqual(curried(2)(3), 6);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should work with placeholders and curried methods', 1, function() {
|
test('should work with placeholders and curried functions', 1, function() {
|
||||||
var fn = function() { return slice.call(arguments); },
|
var fn = function() { return slice.call(arguments); },
|
||||||
curried = _.curry(fn),
|
curried = _.curry(fn),
|
||||||
par = func(curried, ph, 'b', ph, 'd');
|
par = func(curried, ph, 'b', ph, 'd');
|
||||||
|
|||||||
Reference in New Issue
Block a user