[Pkg-javascript-commits] [node-jsonstream] 112/214: test using map function as filter

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 1 12:58:47 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-jsonstream.

commit 9d9aa891ec8d952e8ffe08cbc8453650f59335b1
Author: Dominic Tarr <dominic.tarr at gmail.com>
Date:   Tue May 13 15:48:12 2014 +0200

    test using map function as filter
---
 test/map.js | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/test/map.js b/test/map.js
index aab3218..29b9d89 100644
--- a/test/map.js
+++ b/test/map.js
@@ -19,3 +19,22 @@ test('map function', function (t) {
   stream.end()
 
 })
+
+test('filter function', function (t) {
+
+  var actual = []
+
+  stream = JSONStream
+    .parse([true], function (e) { return e%2 ? e : null})
+    .on('data', function (v) { actual.push(v)})
+    .on('end', function () {
+      t.deepEqual(actual, [1,3,5])
+      t.end()
+
+    })
+
+  stream.write(JSON.stringify([1,2,3,4,5,6], null, 2))
+  stream.end()
+
+})
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-jsonstream.git



More information about the Pkg-javascript-commits mailing list