-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: stream readable readableListening internal state #9864
Conversation
* `readableListening` | ||
*/ | ||
|
||
const commun = require('../common.js'); |
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.
Typo: common
const stream = require('stream'); | ||
|
||
/** | ||
* Fiest test escenary, were we are going to call the |
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.
I'm not sure what this is supposed to say. Also, there is an extra space before the
.
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.
me neither...
/** | ||
* Fiest test escenary, were we are going to call the | ||
* `readable` event and test that `readableListening` state | ||
* change succefully change to `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.
successfully?
}); | ||
|
||
// readableListening state should start in `false`. | ||
assert.deepEqual(r._readableState.readableListening, false); |
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.
No need for deepEqual()
. strictEqual()
is good for comparing primitives.
})); | ||
|
||
// This should trigger some events in our | ||
// first test ecenary |
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.
This can fit on the previous line I think.
* value | ||
*/ | ||
|
||
const r2 = new stream.Readable({ |
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.
Instead of having r
, r2
, etc., you can place the isolated test cases inside a block scope and reuse the same variable names.
*/ | ||
|
||
const r2 = new stream.Readable({ | ||
read: (asd) => {} |
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.
asd
?
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.
The comments in general need some grammar and spell checking.
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.
Some nits on the comments.
/** | ||
* Testing Readable Stream internal state | ||
* `readableListening` | ||
*/ |
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.
can you remove this?
})); | ||
|
||
// This should trigger some events in our | ||
// second test case |
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.
can you remove this comment?
* First test case, were we are going to call the | ||
* `readable` event and test that `readableListening` state | ||
* change successfully change to `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.
can you condense this into a one-liner?
* call the `readable` event and we expect | ||
* that readableListening maintain his `false` | ||
* value | ||
*/ |
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.
can you condense this into a oneliner?
nits resolved |
The linter seems failing. |
@mcollina I cannot find in the CI where is failing, can you see it ? |
Is |
I re-run the CI, is on queue. |
Really funny this error If i call I need to call common without the |
The CI failure looks not related with the PR, can someone confirm ? |
CI failure is unrelated. |
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.
LGTM
Landed 8dbf1af |
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
stream
Description of change
Adding test for the
readableListening
state in stream.ReadableIssue related: #8683
cc: @mcollina