Skip to content

Commit

Permalink
only test equality of tap alias with doto
Browse files Browse the repository at this point in the history
  • Loading branch information
stefano committed Feb 17, 2015
1 parent cf64f27 commit 9fb2e3e
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2829,31 +2829,15 @@ exports['doto'] = function (test) {

exports['doto - noValueOnError'] = noValueOnErrorTest(_.doto(function (x) { return x }));

exports['tap'] = function (test) {
test.expect(4);
exports['tap - doto alias'] = function (test) {
test.expect(2);

var seen;
function record(x) {
seen.push(x * 2);
}
test.strictEqual(_.tap, _.doto);
test.strictEqual(_([]).tap, _([]).doto);

seen = [];
_.tap(record, [1, 2, 3, 4]).toArray(function (xs) {
test.same(xs, [1, 2, 3, 4]);
test.same(seen, [2, 4, 6, 8]);
});

// partial application
seen = [];
_.tap(record)([1, 2, 3, 4]).toArray(function (xs) {
test.same(xs, [1, 2, 3, 4]);
test.same(seen, [2, 4, 6, 8]);
});
test.done();
};

exports['tap - noValueOnError'] = noValueOnErrorTest(_.tap(function (x) { return x }));

exports['flatMap'] = function (test) {
var f = function (x) {
return _(function (push, next) {
Expand Down

0 comments on commit 9fb2e3e

Please sign in to comment.