stream, test: add tests for 'readable' state machine
Add test coverage for:
stream._readableState.needReadable stream._readableState.emittedReadable stream._readableState.readableListening stream._readableState.resumeScheduled
| this.needReadable = false; | |
| this.emittedReadable = false; | |
| this.readableListening = false; | |
| this.resumeScheduled = false; |
Those govern when and how we need to emit a 'readable' event and resume the flow.
The state machine is definitely complex, feel free to ask questions, and look hard at the source code. We can also add comments on the meaning of all those state variables.
Part of #8644.
cc @Fishrock123