-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Even more streams tests #461
Conversation
e5028ea
to
deb214e
Compare
13e16a6
to
5bfc864
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all of the way done yet, but here are a couple things to look at
} | ||
return true; | ||
}) | ||
await rejects(stream.map((x) => x + x).toArray(), /boom/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not too sure on the expected behavior of streams, do we want to check if the error occurs on the third stream object to make sure that things happen in the right order? Similarly, on the async case.
{ | ||
// Test result is a Readable | ||
const stream = Readable.from([1, 2, 3, 4, 5]).filter((x) => true); | ||
strictEqual(stream.readable, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing the negative case may be valuable here. Ex. testing strictEqual(stream.readable, false)
when it is not safe to call read()
strictEqual(source._readableState.pipes[1], dest2); | ||
strictEqual(source._readableState.pipes.length, 2); | ||
|
||
// Should be able to unpipe them in the reverse order that they were piped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should happen if we don't unpipe them in order?
} | ||
}; | ||
|
||
export const pipeMultiplePipes = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently this test is doing the following
┌────────┐
┌────────►│Writable│
│ └────────┘
│
┌───┴─────┐ ┌────────┐
│Readable ├──►│Writable│
└───┬─────┘ └────────┘
│
│ ┌────────┐
└────────►│Writable│
└────────┘
Still going through this PR, but it so far does not have a test for long chains of piped streams.
┌─────────┐ ┌──────┐ ┌──────┐ ... ┌──────┐
│Readable ├─►│Duplex├─►│Duplex├─────►│Duplex│
└─────────┘ └──────┘ └──────┘ └──────┘
No description provided.