stream.push("first chunk"); }).delay(100).then(() => {
expect(res).toBeInstanceOf(Stream.Readable); expect(res.readableObjectMode === true || (res._readableState && res._readableState.objectMode === true)).toBe(true); res.on("data", msg => FLOW.push(msg)); res.on("error", err => FLOW.push("<ERROR:" + err.message + ">")); res.on("end", () => FLOW.push("<END>")); }) .then(() => stream.push({ "id": 123, data: "first record" })) .delay(100) .then(() => { { "id": 123, data: "first record" } ]); stream.push({ "id": 786, data: "second record" }); }) .delay(100) expect(res).toBeInstanceOf(Stream.Readable); expect(res.readableObjectMode === true || (res._readableState && res._readableState.objectMode === true)).toBe(true); res.on("data", msg => FLOW.push(msg)); res.on("error", err => FLOW.push("<ERROR:" + err.message + ">")); res.on("end", () => FLOW.push("<END>")); }) .then(() => stream.push({ "id": 123, data: "first record" })) .delay(100) .then(() => {
expect(ctx.params).toBeInstanceOf(Stream.Readable); expect(ctx.params.readableObjectMode === true || (ctx.params._readableState && ctx.params._readableState.objectMode === true)).toBe(true); ctx.params.on("data", msg => FLOW.push(msg)); ctx.params.on("error", err => { FLOW.push("<ERROR:" + err.message + ">"); }); ctx.params.on("end", () => FLOW.push("<END>")); .then(() => b1.call("data.store", stream)) .then(res => expect(res).toBe("OK")) .then(() => stream.push({ "id": 123, data: "first record" })) .delay(100) .then(() => { { "id": 123, data: "first record" } ]); stream.push({ "id": 786, data: "second record" }); }) .delay(100) .then(() => b1.call("data.store", stream)) .then(res => expect(res).toBe("OK")) .then(() => stream.push({ "id": 123, data: "first record" })) .delay(100) .then(() => {
stream.push(randomData); }).delay(100).then(() => {
ctx.params.on("data", msg => pass.push({ line: ++line, data: msg })); ctx.params.on("end", () => pass.emit("end")); ctx.params.on("error", err => pass.emit("error", err)); expect(res).toBeInstanceOf(Stream.Readable); expect(res.readableObjectMode === true || (res._readableState && res._readableState.objectMode === true)).toBe(true); res.on("data", msg => FLOW.push(msg)); res.on("error", err => FLOW.push("<ERROR:" + err.message + ">")); res.on("end", () => FLOW.push("<END>")); }) .then(() => stream.push({ "id": 123, data: "first record" })) .delay(100) .then(() => { { line: 1, data: { "id": 123, data: "first record" } } ]); stream.push({ "id": 786, data: "second record" }); }) .delay(100) expect(res).toBeInstanceOf(Stream.Readable); expect(res.readableObjectMode === true || (res._readableState && res._readableState.objectMode === true)).toBe(true); res.on("data", msg => FLOW.push(msg)); res.on("error", err => FLOW.push("<ERROR:" + err.message + ">")); res.on("end", () => FLOW.push("<END>")); }) .then(() => stream.push({ "id": 123, data: "first record" })) .delay(100) .then(() => {
stream.push("first chunk"); }).delay(100).then(() => {
expect(FLOW).toEqual([]); expect(ctx.params).toBeInstanceOf(Stream.Readable); ctx.params.on("data", msg => FLOW.push(msg.toString())); ctx.params.on("error", err => { FLOW.push("<ERROR:" + err.message + ">"); }); ctx.params.on("end", () => FLOW.push("<END>")); .then(() => b1.call("file.save", stream)) .then(res => expect(res).toBe("OK")) .then(() => stream.push("first chunk")) .delay(100) .then(() => { "first chunk" ]); stream.push(Buffer.from("second chunk")); }) .delay(100) .then(() => b1.call("file.save", stream)) .then(res => expect(res).toBe("OK")) .then(() => stream.push("first chunk")) .delay(100) .then(() => {
stream.push(randomData); }).delay(100).then(() => {
const pass = new Stream.Transform({ transform: function(chunk, encoding, done) { this.push(chunk.toString().toUpperCase()); return done(); .then(res => { expect(res).toBeInstanceOf(Stream.Readable); res.on("data", msg => FLOW.push(msg.toString())); res.on("error", err => FLOW.push("<ERROR:" + err.message + ">")); res.on("end", () => FLOW.push("<END>")); }) .then(() => stream.push("first chunk")) .delay(100) .then(() => { "FIRST CHUNK" ]); stream.push(Buffer.from("second chunk")); }) .delay(100) .then(res => { expect(res).toBeInstanceOf(Stream.Readable); res.on("data", msg => FLOW.push(msg.toString())); res.on("error", err => FLOW.push("<ERROR:" + err.message + ">")); res.on("end", () => FLOW.push("<END>")); }) .then(() => stream.push("first chunk")) .delay(100)
.then(res => { expect(res).toBeInstanceOf(Stream.Readable); res.on("data", msg => FLOW.push(msg.toString())); res.on("error", err => FLOW.push("<ERROR:" + err.message + ">")); res.on("end", () => FLOW.push("<END>")); }) .then(() => stream.push("first chunk")) .delay(100) .then(() => { "first chunk" ]); stream.push(Buffer.from("second chunk")); }) .delay(100) .then(res => { expect(res).toBeInstanceOf(Stream.Readable); res.on("data", msg => FLOW.push(msg.toString())); res.on("error", err => FLOW.push("<ERROR:" + err.message + ">")); res.on("end", () => FLOW.push("<END>")); }) .then(() => stream.push("first chunk")) .delay(100) .then(() => {