Re: [whatwg/streams] Check precisely the way that transformer.transform() is called (#689)

ricea commented on this pull request.



> @@ -300,4 +300,36 @@ promise_test(() => {
   return readableStreamToArray(ts.readable);
 }, 'methods should not not have .apply() or .call() called');
 
+promise_test(t => {
+  const transformer = {
+    transform() {
+      transformer.transform = undefined;
+      throw new TypeError();
+    }
+  };
+  const ts = new TransformStream(transformer);
+  return Promise.all([
+    promise_rejects(t, new TypeError(), ts.writable.getWriter().write('a'), 'write() should throw'),
+    promise_rejects(t, new TypeError(), ts.readable.getReader().read(), 'read() should throw')

Ah, I have a better idea. With the incorrect implementation, both transform() and the fallback will be called. So I can test for that.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/689#discussion_r105074553

Received on Thursday, 9 March 2017 02:25:26 UTC