[Pkg-javascript-commits] [node-jsonstream] 91/214: simple tape test for browser/testling
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 1 12:58:44 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 043f015d80bfb3fdf268f429922bcf9280bd3e78
Author: Max Ogden <max at maxogden.com>
Date: Sun Apr 7 16:17:19 2013 -0700
simple tape test for browser/testling
---
package.json | 2 +-
test/browser.js | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 79b05fd..28333f4 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,7 @@
"render": "~0.1.1",
"trees": "~0.0.3",
"event-stream": "~0.7.0",
- "tape": "~0.2.2"
+ "tape": "~0.3.3"
},
"author": "Dominic Tarr <dominic.tarr at gmail.com> (http://bit.ly/dominictarr)",
"scripts": {
diff --git a/test/browser.js b/test/browser.js
new file mode 100644
index 0000000..3c28d49
--- /dev/null
+++ b/test/browser.js
@@ -0,0 +1,18 @@
+var test = require('tape')
+var JSONStream = require('../')
+var testData = '{"rows":[{"hello":"world"}, {"foo": "bar"}]}'
+
+test('basic parsing', function (t) {
+ t.plan(2)
+ var parsed = JSONStream.parse("rows.*")
+ var parsedKeys = {}
+ parsed.on('data', function(match) {
+ parsedKeys[Object.keys(match)[0]] = true
+ })
+ parsed.on('end', function() {
+ t.equal(!!parsedKeys['hello'], true)
+ t.equal(!!parsedKeys['foo'], true)
+ })
+ parsed.write(testData)
+ parsed.end()
+})
\ No newline at end of file
--
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