-
-
Save Raynos/5000773 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test("high water mark", function (assert) { | |
var count = 100 | |
var list = [] | |
for (var i = 0; i < count; i++) { | |
list.push(i) | |
} | |
var s = Readable({ | |
objectMode: true | |
, highWaterMark: 100 | |
}) | |
s._read = function () { | |
var bools = list.map(function (i) { | |
return s.push(i) | |
}) | |
assert.ok(bools.every(function (x) { | |
return x === true | |
})) | |
var needMore = s.push(100) | |
// IS ACTUALLY TRUE ;_; because s.needReadable is set | |
// I think if push makes it go over the high water mark we should | |
// return false and ignore the fact we need a readable. | |
assert.equal(needMore, false) | |
// console.log("s", s._readableState) | |
} | |
s.read(0) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment