| <!DOCTYPE html> |
| <script src='../resources/testharness.js'></script> |
| <script src='../resources/testharnessreport.js'></script> |
| <script> |
| // This is updated till https://github.com/whatwg/streams/commit/8d5f2ec3d74d501988e00b427468e11aa7855637 |
| |
| test(function() { |
| const rs = new ReadableStream(); |
| const reader = rs.getReader(); |
| assert_equals(reader.constructor.name, 'ReadableStreamDefaultReader'); |
| }, 'getReader() should return a ReadableStreamDefaultReader'); |
| |
| test(function() { |
| const rs = new ReadableStream(); |
| assert_throws(new TypeError(), function() { rs.getReader({mode: 'byob'}) }); |
| }, "getReader({mode: 'byob'}) should return a TypeError as BYOB reader is not yet implemented"); |
| |
| test(function() { |
| const rs = new ReadableStream(); |
| // Any value different from undefined and 'byob' should throw a TypeError. |
| assert_throws(new RangeError(), function() { rs.getReader({mode : 'aMode'}) }); |
| }, "getReader({mode: 'aMode'}) should return a RangeError as 'aMode' is different from undefined and 'byob'"); |
| </script> |