1var test = require('tape') 2var JSONStream = require('../') 3var testData = '{"rows":[{"hello":"world"}, {"foo": "bar"}]}' 4 5test('basic parsing', function (t) { 6 t.plan(2) 7 var parsed = JSONStream.parse("rows.*") 8 var parsedKeys = {} 9 parsed.on('data', function(match) { 10 parsedKeys[Object.keys(match)[0]] = true 11 }) 12 parsed.on('end', function() { 13 t.equal(!!parsedKeys['hello'], true) 14 t.equal(!!parsedKeys['foo'], true) 15 }) 16 parsed.write(testData) 17 parsed.end() 18})