1 2var fs = require ('fs') 3 , join = require('path').join 4 , file = join(__dirname, 'fixtures','all_npm.json') 5 , JSONStream = require('../') 6 , it = require('it-is').style('colour') 7 8 function randomObj () { 9 return ( 10 Math.random () < 0.4 11 ? {hello: 'eonuhckmqjk', 12 whatever: 236515, 13 lies: true, 14 nothing: [null], 15// stuff: [Math.random(),Math.random(),Math.random()] 16 } 17 : ['AOREC', 'reoubaor', {ouec: 62642}, [[[], {}, 53]]] 18 ) 19 } 20 21var expected = [] 22 , stringify = JSONStream.stringify() 23 , es = require('event-stream') 24 , stringified = '' 25 , called = 0 26 , count = 10 27 , ended = false 28 29while (count --) 30 expected.push(randomObj()) 31 32 es.connect( 33 es.readArray(expected), 34 stringify, 35 JSONStream.parse([true]), 36 es.writeArray(function (err, lines) { 37 38 it(lines).has(expected) 39 console.error('PASSED') 40 }) 41 ) 42