Ensure _.flow and _.flowRight works with _.first. [closes #1308]

This commit is contained in:
jdalton
2015-06-29 21:07:46 -07:00
parent 29ceed91f0
commit d93aa183f3
2 changed files with 37 additions and 7 deletions

View File

@@ -2248,6 +2248,16 @@
notStrictEqual(combined, _.identity);
});
test('`_.' + methodName + '` should work with a curried function and `_.first`', 1, function() {
var curried = _.curry(_.identity);
var combined = isFlow
? func(_.first, curried)
: func(curried, _.first);
strictEqual(combined([1]), 1);
});
test('`_.' + methodName + '` should support shortcut fusion', 12, function() {
var filterCount,
mapCount;
@@ -4796,6 +4806,16 @@
}
});
test('should not execute immediately when explicitly chaining', 1, function() {
if (!isNpm) {
var wrapped = _(array).chain().first();
strictEqual(wrapped.__wrapped__, array);
}
else {
skipTest();
}
});
test('should work in a lazy chain sequence', 1, function() {
if (!isNpm) {
var array = _.range(1, LARGE_ARRAY_SIZE + 1);
@@ -9261,6 +9281,16 @@
}
});
test('should not execute immediately when explicitly chaining', 1, function() {
if (!isNpm) {
var wrapped = _(array).chain().last();
strictEqual(wrapped.__wrapped__, array);
}
else {
skipTest();
}
});
test('should work in a lazy chain sequence', 1, function() {
if (!isNpm) {
var array = _.range(1, LARGE_ARRAY_SIZE + 1),