[Pkg-javascript-commits] [node-jsonstream] 106/214: test for objects with null properties

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 1 12:58:46 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 d15750f64532869ff1571b5168fc39ef56cb4b00
Author: Dominic Tarr <dominic.tarr at gmail.com>
Date:   Tue May 13 15:29:04 2014 +0200

    test for objects with null properties
---
 test/null.js | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/test/null.js b/test/null.js
new file mode 100644
index 0000000..95dd60c
--- /dev/null
+++ b/test/null.js
@@ -0,0 +1,28 @@
+var JSONStream = require('../')
+
+var data = [
+  {ID: 1, optional: null},
+  {ID: 2, optional: null},
+  {ID: 3, optional: 20},
+  {ID: 4, optional: null},
+  {ID: 5, optional: 'hello'},
+  {ID: 6, optional: null}
+]
+
+
+var test = require('tape')
+
+test ('null properties', function (t) {
+  var actual = []
+  var stream = 
+
+  JSONStream.parse('*.optional')
+    .on('data', function (v) { actual.push(v) })
+    .on('end', function () {
+      t.deepEqual(actual, [20, 'hello'])
+      t.end()
+    })
+
+  stream.write(JSON.stringify(data, 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