You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
921 B
41 lines
921 B
|
|
var fs = require ('fs') |
|
, join = require('path').join |
|
, file = join(__dirname, 'fixtures','all_npm.json') |
|
, JSONStream = require('../') |
|
, it = require('it-is').style('colour') |
|
|
|
function randomObj () { |
|
return ( |
|
Math.random () < 0.4 |
|
? {hello: 'eonuhckmqjk', |
|
whatever: 236515, |
|
lies: true, |
|
nothing: [null], |
|
// stuff: [Math.random(),Math.random(),Math.random()] |
|
} |
|
: ['AOREC', 'reoubaor', {ouec: 62642}, [[[], {}, 53]]] |
|
) |
|
} |
|
|
|
var expected = [] |
|
, stringify = JSONStream.stringify() |
|
, es = require('event-stream') |
|
, stringified = '' |
|
, called = 0 |
|
, count = 10 |
|
, ended = false |
|
|
|
while (count --) |
|
expected.push(randomObj()) |
|
|
|
es.connect( |
|
es.readArray(expected), |
|
stringify, |
|
JSONStream.parse([true]), |
|
es.writeArray(function (err, lines) { |
|
|
|
it(lines).has(expected) |
|
console.error('PASSED') |
|
}) |
|
)
|
|
|