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

domenic commented on this pull request.



> +  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')
+  ]);
+}, 'transformer.transform should be checked for undefined before being called');
+
+promise_test(() => {
+  let transformGetterCalls = 0;
+  const ts = new TransformStream({
+    get transform() {
+      ++transformGetterCalls;
+      return (chunk, controller) => controller.enqueue(chunk);
+    }
+  });
+  const writer = ts.writable.getWriter();
+  writer.write('a');

Oh, right. Yeah, that would be pretty different...

Ideally we'd add another test that writes two chunks and tests that it's looked up exactly twice, then. Otherwise this test is kind of confusing to me.

-- 
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_r105074292

Received on Thursday, 9 March 2017 02:22:36 UTC