[Pkg-javascript-commits] [node-jsonstream] 147/214: Add unit test for issue #66

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 1 12:58:52 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 43b3dffdee1c55de8ff46a2e8b74b2388e7d7da1
Author: Guillaume Chauvet <g.chauvet at bimedia.com.fr>
Date:   Fri Apr 17 09:22:49 2015 +0200

    Add unit test for issue #66
---
 test/unvalid_stream.js | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/test/unvalid_stream.js b/test/unvalid_stream.js
new file mode 100644
index 0000000..53a1be2
--- /dev/null
+++ b/test/unvalid_stream.js
@@ -0,0 +1,37 @@
+
+
+var stream = require ('stream');
+var JSONStream = require('../');
+var it = require('it-is');
+
+var parser = JSONStream.parse('*')
+  , called = 0
+  , ended = false
+  , error = false
+  , parsed = [];
+  
+var s = new stream.Readable();
+s._read = function noop() {};
+s.push('["foo":bar[');
+s.push(null);
+
+parser.on('data', function (data) {
+  called++;
+});
+
+parser.on('end', function () {
+  ended = true;
+});
+
+parser.on('error', function () {
+  error = true;
+});
+
+s.pipe(parser);
+
+process.on('exit', function () {
+  it(ended).equal(true);
+  it(error).equal(true);
+  it(called).equal(0);
+  console.error('PASSED');
+})
\ No newline at end of file

-- 
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