- From: Domenic Denicola <notifications@github.com>
- Date: Thu, 05 Feb 2015 21:05:39 -0800
- To: whatwg/streams <streams@noreply.github.com>
Received on Friday, 6 February 2015 05:06:15 UTC
> + }
> + });
> +
> + t.equal(rs.state, 'waiting', 'stream starts out waiting');
> +
> + rs.ready.then(() => {
> + t.equal(rs.state, 'readable', 'stream becomes readable (even before promise fulfills)');
> + t.equal(timesCalled, 1, 'pull is not yet called a second time');
> + t.equal(rs.read(), 1, 'read() returns enqueued value');
> +
> + setTimeout(() => {
> + t.equal(timesCalled, 1, 'after 30 ms, pull has still only been called once');
> +
> + resolve();
> +
> + returnedPromise.then(() => {
I agree that Promise.resolve().then(...) would work. But don't you think a good way to verify "pull() will be called once the returnedPromise is resolved" is `returnedPromise.then(() => checkThatPullWasCalled())`?
One way of looking at it is that I could move the resolve() call on L315 somewhere else randomly (say, in a top-level `setTimeout(resolve, 100)`). L317 is meant to stand on its own independent of L315.
---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/272/files#r24222871
Received on Friday, 6 February 2015 05:06:15 UTC