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

Throw a TypeError in ReadableStreamBYOBReader constructor if stream isn't a byte stream #638

Merged
merged 6 commits into from Jan 6, 2017

Fix capitalisation of ReadableStreamBYOBReader

It was capitalised as ReadableStreamByobReader in the new tests.
  • Loading branch information...
ricea authored and domenic committed Jan 6, 2017
commit 92990934e0bb560eac543c384ccf9340e7960594
@@ -2197,30 +2197,30 @@ test('ReadableStream with byte source: Throwing in pull in response to read(view
});
});
test('ReadableStreamByobReader can be constructed directly', t => {
const ReadableStreamByobReader = new ReadableStream({ type: 'bytes' }).getReader({ mode: 'byob' }).constructor;
test('ReadableStreamBYOBReader can be constructed directly', t => {
const ReadableStreamBYOBReader = new ReadableStream({ type: 'bytes' }).getReader({ mode: 'byob' }).constructor;
const stream = new ReadableStream({ type: 'bytes' });
new ReadableStreamByobReader(stream);
new ReadableStreamBYOBReader(stream);
t.end();
});
test('ReadableStreamByobReader constructor requires a ReadableStream argument', t => {
const ReadableStreamByobReader = new ReadableStream({ type: 'bytes' }).getReader({ mode: 'byob' }).constructor;
t.throws(() => new ReadableStreamByobReader({}), TypeError, 'constructor must throw');
test('ReadableStreamBYOBReader constructor requires a ReadableStream argument', t => {
const ReadableStreamBYOBReader = new ReadableStream({ type: 'bytes' }).getReader({ mode: 'byob' }).constructor;
t.throws(() => new ReadableStreamBYOBReader({}), TypeError, 'constructor must throw');
t.end();
});
test('ReadableStreamByobReader constructor requires an unlocked ReadableStream', t => {
const ReadableStreamByobReader = new ReadableStream({ type: 'bytes' }).getReader({ mode: 'byob' }).constructor;
test('ReadableStreamBYOBReader constructor requires an unlocked ReadableStream', t => {
const ReadableStreamBYOBReader = new ReadableStream({ type: 'bytes' }).getReader({ mode: 'byob' }).constructor;
const stream = new ReadableStream({ type: 'bytes' });
stream.getReader();
t.throws(() => new ReadableStreamByobReader(stream), TypeError, 'constructor must throw');
t.throws(() => new ReadableStreamBYOBReader(stream), TypeError, 'constructor must throw');
t.end();
});
test('ReadableStreamByobReader constructor requires a ReadableStream with type "bytes"', t => {
const ReadableStreamByobReader = new ReadableStream({ type: 'bytes' }).getReader({ mode: 'byob' }).constructor;
test('ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes"', t => {
const ReadableStreamBYOBReader = new ReadableStream({ type: 'bytes' }).getReader({ mode: 'byob' }).constructor;
const stream = new ReadableStream();
t.throws(() => new ReadableStreamByobReader(stream), TypeError, 'constructor must throw');
t.throws(() => new ReadableStreamBYOBReader(stream), TypeError, 'constructor must throw');
t.end();
});
ProTip! Use n and p to navigate between commits in a pull request.