Permalink
Browse files

doubleOdd test to check values too

  • Loading branch information...
1 parent e8578c1 commit 5baad16b2846f05c8c382e681e5b69eae0b2479f @substack committed Jun 8, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 test/fn.js
View
@@ -12,12 +12,16 @@ test('use a function to determine keys', function (t) {
function True () { return true }
function even (n) { return n % 2 === 0 }
function odd (n) { return n % 2 === 1 }
+ function doubleOdd (key, value) { return odd(key) && odd(value) }
var odds = pathway(xs, [ True, odd ]);
t.same(odds, [ 1, 2, 3, 4, 5 ]);
var evens = pathway(xs, [ True, even ]);
t.same(evens, [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h' ]);
+ var doubleOdds = pathway(xs, [ True, doubleOdd ]);
+ t.same(doubleOdds, [ 1, 3, 5 ]);
+
t.end();
});

0 comments on commit 5baad16

Please sign in to comment.