Sha256: a128f81ef0aef7797db3f7173a669da64f88c6ccfd135405a8ef4471d164d2cb

Contents?: true

Size: 1.04 KB

Versions: 16

Compression:

Stored size: 1.04 KB

Contents

var fs = require ('fs');
var net = require('net');
var join = require('path').join;
var file = join(__dirname, 'fixtures','all_npm.json');
var it = require('it-is');
var JSONStream = require('../');

var str = fs.readFileSync(file);

var datas = {}

var server = net.createServer(function(client) {
    var root_calls = 0;
    var data_calls = 0;
    var parser = JSONStream.parse(['rows', true, 'key']);
    parser.on('root', function(root, count) {
        ++ root_calls;
    });

    parser.on('data', function(data) {
        ++ data_calls;
        datas[data] = (datas[data] || 0) + 1
        it(data).typeof('string')
    });

    parser.on('end', function() {
        console.log('END')
        var min = Infinity
        for (var d in datas) 
          min = min > datas[d] ? datas[d] : min
        it(root_calls).equal(3);
        it(min).equal(3);
        server.close();
    });
    client.pipe(parser);
});
server.listen(9999);

var client = net.connect({ port : 9999 }, function() {
    var msgs = str + ' ' + str + '\n\n' + str
    client.end(msgs);
});

Version data entries

16 entries across 8 versions & 4 rubygems

Version Path
minimum_viable_product-0.0.11 test/dummy/node_modules/browserify-incremental/node_modules/JSONStream/test/multiple_objects.js
snowball-0.1.22 node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects.js
sprockets-browserify-0.3.0 node_modules/browserify/node_modules/deps-sort/node_modules/JSONStream/test/multiple_objects.js
sprockets-browserify-0.3.0 node_modules/browserify/node_modules/JSONStream/test/multiple_objects.js
sprockets-browserify-0.3.0 node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects.js
sprockets-browserify-0.3.0 node_modules/browserify/node_modules/browser-pack/node_modules/JSONStream/test/multiple_objects.js
sprockets-browserify-0.2.0 node_modules/browserify/node_modules/browser-resolve/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects.js
sprockets-browserify-0.2.0 node_modules/browserify/node_modules/JSONStream/test/multiple_objects.js
ruby-wisp-source-0.8.0 vendor/node_modules/browserify/node_modules/browser-resolve/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects.js
ruby-wisp-source-0.8.0 vendor/node_modules/browserify/node_modules/JSONStream/test/multiple_objects.js
ruby-wisp-source-0.7.0 vendor/node_modules/browserify/node_modules/browser-resolve/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects.js
ruby-wisp-source-0.7.0 vendor/node_modules/browserify/node_modules/JSONStream/test/multiple_objects.js
sprockets-browserify-0.1.2 node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects.js
sprockets-browserify-0.1.2 node_modules/JSONStream/test/multiple_objects.js
sprockets-browserify-0.1.0 node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects.js
sprockets-browserify-0.1.0 node_modules/JSONStream/test/multiple_objects.js