[Pkg-javascript-commits] [node-stream-splicer] 39/71: test for nested pipelines
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:55:50 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 b84ba0070f2a5f1dbba8d15f370a20ca657805ed
Author: James Halliday <mail at substack.net>
Date: Mon Jun 9 19:23:33 2014 -0700
test for nested pipelines
---
test/nested.js | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/test/nested.js b/test/nested.js
new file mode 100644
index 0000000..50c2f11
--- /dev/null
+++ b/test/nested.js
@@ -0,0 +1,37 @@
+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('nested splicer', function (t) {
+ t.plan(1);
+
+ var addNewLines = through(function (buf, enc, next) {
+ this.push(buf + '\n');
+ next();
+ });
+
+ var stream = pipeline.obj([
+ [ split(), addNewLines ],
+ through(function (buf, enc, next) {
+ this.push('> ' + buf);
+ next()
+ })
+ ]);
+
+ stream.get(0).unshift(through(function (buf, enc, next) {
+ this.push(buf.toString('utf8').toUpperCase());
+ next();
+ }));
+
+ stream.pipe(concat(function (body) {
+ t.deepEqual(body.toString(), '> A\n> B\n> C\n');
+ }));
+
+ stream.write('a\n');
+ stream.write('b\n');
+ stream.write('c\n');
+ 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