[Pkg-javascript-commits] [node-stream-splicer] 31/71: multiunshift test already works
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:55:49 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-stream-splicer.
commit 9d08bae682ba900b38031d6cc5c3346446f4c008
Author: James Halliday <mail at substack.net>
Date: Mon Jun 9 14:07:30 2014 -0700
multiunshift test already works
---
test/multiunshift.js | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/test/multiunshift.js b/test/multiunshift.js
new file mode 100644
index 0000000..e408fc3
--- /dev/null
+++ b/test/multiunshift.js
@@ -0,0 +1,31 @@
+var pipeline = require('../');
+var through = require('through2');
+var stringify = require('JSONStream').stringify;
+var split = require('split');
+var concat = require('concat-stream');
+var test = require('tape');
+
+test('multiunshift', function (t) {
+ t.plan(1);
+
+ var a = split();
+ var b = through.obj(function (row, enc, next) {
+ this.push(JSON.parse(row));
+ next();
+ });
+ var c = through.obj(function (row, enc, next) { this.push(row.x); next() });
+ var d = through.obj(function (x, enc, next) { this.push(x * 111); next() });
+ var e = stringify();
+
+ var stream = pipeline();
+ stream.unshift(d, e);
+ stream.unshift(a, b, c);
+ stream.pipe(concat(function (body) {
+ t.deepEqual(body.toString(), '[\n333\n,\n444\n,\n555\n]\n');
+ }));
+
+ stream.write('{"x":3}\n');
+ stream.write('{"x":4}\n');
+ stream.write('{"x":5}');
+ stream.end();
+});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stream-splicer.git
More information about the Pkg-javascript-commits
mailing list