[Pkg-javascript-commits] [node-jsonstream] 58/214: update tests to cover excepted behaviour better
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 1 12:58:39 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-jsonstream.
commit f2e5ac1717c437310b8a929653a78a8574a35a2b
Author: Dominic Tarr <dominic.tarr at gmail.com>
Date: Sat Sep 8 21:38:45 2012 +0200
update tests to cover excepted behaviour better
---
test/multiple_objects.js | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/test/multiple_objects.js b/test/multiple_objects.js
index e7b8500..b1c8f91 100644
--- a/test/multiple_objects.js
+++ b/test/multiple_objects.js
@@ -6,25 +6,30 @@ var it = require('it-is');
var JSONStream = require('../');
var str = fs.readFileSync(file);
-var expected = JSON.parse(str);
+
+var datas = {}
var server = net.createServer(function(client) {
var root_calls = 0;
var data_calls = 0;
- var parser = JSONStream.parse();
+ var parser = JSONStream.parse(['rows', true, 'key']);
parser.on('root', function(root, count) {
++ root_calls;
});
parser.on('data', function(data) {
++ data_calls;
- it(data).deepEqual(expected)
+ datas[data] = (datas[data] || 0) + 1
+ it(data).typeof('string')
});
parser.on('end', function() {
- console.error('END');
+ console.log('END')
+ var min = Infinity
+ for (var d in datas)
+ min = min > datas[d] ? datas[d] : min
it(root_calls).equal(3);
- it(data_calls).equal(3);
+ it(min).equal(3);
server.close();
});
client.pipe(parser);
@@ -32,6 +37,6 @@ var server = net.createServer(function(client) {
server.listen(9999);
var client = net.connect({ port : 9999 }, function() {
- var msgs = [str, str, str].join('');
+ var msgs = str + ' ' + str + '\n\n' + str
client.end(msgs);
});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-jsonstream.git
More information about the Pkg-javascript-commits
mailing list