Re: [streams] Convert readable stream pull() to promise-returning (#272)

> +    }
> +  });
> +
> +  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(() => {

looks a little misleading. can't we just use Promise.resolve(undefined).then(...) or setTimeout(..., 0)?

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/272/files#r24150104

Received on Thursday, 5 February 2015 08:56:47 UTC