Skip to content

Commit 27bba8d

Browse files
committed
Conform to readable stream spec
One of the tests was failing because it was testing that when a stream became readable it never returned a `null` datum on call to `stream.read()`. In fact, when a readable stream drains it should & does return `null` for calls to `stream.read()` as described [here](https://nodejs.org/api/stream.html#stream_event_readable) I updated the test to account for this, and they pass now.
1 parent e9d1872 commit 27bba8d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
},
3333
"dependencies": {
3434
"pg-cursor": "1.0.0",
35-
"readable-stream": "^1.0.27-1"
35+
"readable-stream": "^2.0.4"
3636
}
3737
}

test/fast-reader.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ helper('fast reader', function(client) {
1010
var count = 0
1111
stream.on('readable', function() {
1212
var res = stream.read()
13-
assert(res, 'should not return null on evented reader')
13+
if (result.length !== 201) {
14+
assert(res, 'should not return null on evented reader')
15+
} else {
16+
//a readable stream will emit a null datum when it finishes being readable
17+
//https://nodejs.org/api/stream.html#stream_event_readable
18+
assert.equal(res, null)
19+
}
1420
if(res) {
1521
result.push(res.num)
1622
}

0 commit comments

Comments
 (0)