Skip to content

Commit

Permalink
Merge pull request #232 from svozza/make-doto-tests-more-DRY
Browse files Browse the repository at this point in the history
Only test equality of tap alias with doto.
  • Loading branch information
vqvu committed Feb 19, 2015
2 parents cf64f27 + 9fb2e3e commit dbb232e
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 dbb232e

Please sign in to comment.