Skip to content

Commit bc96528

Browse files
committed
Compose test coverage
1 parent 13ae2d6 commit bc96528

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/functions.js

+16
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,22 @@
476476

477477
composed = _.compose(greet, exclaim);
478478
equal(composed('moe'), 'hi: moe!', 'in this case, the functions are also commutative');
479+
480+
// f(g(h(x, y, z)))
481+
function h(x, y, z) {
482+
equal(arguments.length, 3, 'First function called with multiple args');
483+
return z * y;
484+
};
485+
function g(x) {
486+
equal(arguments.length, 1, 'Composed function is called with 1 argument');
487+
return x;
488+
};
489+
function f(x) {
490+
equal(arguments.length, 1, 'Composed function is called with 1 argument');
491+
return x * 2;
492+
};
493+
composed = _.compose(f, g, h);
494+
equal(composed(1, 2, 3), 12);
479495
});
480496

481497
test('after', function() {

0 commit comments

Comments
 (0)