Revision control

1
<!DOCTYPE html>
2
<script src='../resources/testharness.js'></script>
3
<script src='../resources/testharnessreport.js'></script>
4
<script>
6
7
test(function() {
8
const rs = new ReadableStream();
9
const reader = rs.getReader();
10
assert_equals(reader.constructor.name, 'ReadableStreamDefaultReader');
11
}, 'getReader() should return a ReadableStreamDefaultReader');
12
13
test(function() {
14
const rs = new ReadableStream();
15
assert_throws(new TypeError(), function() { rs.getReader({mode: 'byob'}) });
16
}, "getReader({mode: 'byob'}) should return a TypeError as BYOB reader is not yet implemented");
17
18
test(function() {
19
const rs = new ReadableStream();
20
// Any value different from undefined and 'byob' should throw a TypeError.
21
assert_throws(new RangeError(), function() { rs.getReader({mode : 'aMode'}) });
22
}, "getReader({mode: 'aMode'}) should return a RangeError as 'aMode' is different from undefined and 'byob'");
23
</script>