diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2021-01-15 08:57:19 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-15 08:57:19 +1100 |
commit | b8303c7812e3483c9ce63bbd8e2a9d420a47aee9 (patch) | |
tree | 92eed14cda38e09309489d882a94c03a90927aed /cli/tests/unit/fetch_test.ts | |
parent | 2d1208556ad09844407c484b1e23887e3ade97c7 (diff) |
refactor(op_crate/fetch): align streams to spec (#9103)
Fixes #8814
Diffstat (limited to 'cli/tests/unit/fetch_test.ts')
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index 285e05a7d..a01b09d13 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -1047,9 +1047,13 @@ unitTest( const buf = bufferServer(addr); const stream = new TransformStream(); const writer = stream.writable.getWriter(); - await writer.write(new TextEncoder().encode("hello ")); - await writer.write(new TextEncoder().encode("world")); - await writer.close(); + // transformer writes don't resolve until they are read, so awaiting these + // will cause the transformer to hang, as the suspend the transformer, it + // is also illogical to await for the reads, as that is the whole point of + // streams is to have a "queue" which gets drained... + writer.write(new TextEncoder().encode("hello ")); + writer.write(new TextEncoder().encode("world")); + writer.close(); const response = await fetch(`http://${addr}/blah`, { method: "POST", headers: [ |