Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Commit

Permalink
simple tape test for browser/testling
Browse files Browse the repository at this point in the history
  • Loading branch information
max-mapper committed Apr 7, 2013
1 parent 2fca91c commit 043f015
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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@gmail.com> (http://bit.ly/dominictarr)",
"scripts": {
Expand Down
18 changes: 18 additions & 0 deletions test/browser.js
Original file line number Diff line number Diff line change
@@ -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()
})

0 comments on commit 043f015

Please sign in to comment.