diff options
author | Casper Beyer <caspervonb@pm.me> | 2021-02-02 19:05:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-02 12:05:46 +0100 |
commit | 6abf126c2a7a451cded8c6b5e6ddf1b69c84055d (patch) | |
tree | fd94c013a19fcb38954844085821ec1601c20e18 /std/node/_stream/end_of_stream_test.ts | |
parent | a2b5d44f1aa9d64f448a2a3cc2001272e2f60b98 (diff) |
chore: remove std directory (#9361)
This removes the std folder from the tree.
Various parts of the tests are pretty tightly dependent
on std (47 direct imports and 75 indirect imports, not
counting the cli tests that use them as fixtures) so I've
added std as a submodule for now.
Diffstat (limited to 'std/node/_stream/end_of_stream_test.ts')
-rw-r--r-- | std/node/_stream/end_of_stream_test.ts | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/std/node/_stream/end_of_stream_test.ts b/std/node/_stream/end_of_stream_test.ts deleted file mode 100644 index 571e75b99..000000000 --- a/std/node/_stream/end_of_stream_test.ts +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright Node.js contributors. All rights reserved. MIT License. -import finished from "./end_of_stream.ts"; -import Readable from "./readable.ts"; -import Transform from "./transform.ts"; -import Writable from "./writable.ts"; -import { mustCall } from "../_utils.ts"; -import { assert, fail } from "../../testing/asserts.ts"; -import { deferred, delay } from "../../async/mod.ts"; - -Deno.test("Finished appends to Readable correctly", async () => { - const rs = new Readable({ - read() {}, - }); - - const [finishedExecution, finishedCb] = mustCall((err) => { - assert(!err); - }); - - finished(rs, finishedCb); - - rs.push(null); - rs.resume(); - - await finishedExecution; -}); - -Deno.test("Finished appends to Writable correctly", async () => { - const ws = new Writable({ - write(_data, _enc, cb) { - cb(); - }, - }); - - const [finishedExecution, finishedCb] = mustCall((err) => { - assert(!err); - }); - - finished(ws, finishedCb); - - ws.end(); - - await finishedExecution; -}); - -Deno.test("Finished appends to Transform correctly", async () => { - const tr = new Transform({ - transform(_data, _enc, cb) { - cb(); - }, - }); - - let finish = false; - let ended = false; - - tr.on("end", () => { - ended = true; - }); - - tr.on("finish", () => { - finish = true; - }); - - const [finishedExecution, finishedCb] = mustCall((err) => { - assert(!err); - assert(finish); - assert(ended); - }); - - finished(tr, finishedCb); - - tr.end(); - tr.resume(); - - await finishedExecution; -}); - -Deno.test("The function returned by Finished clears the listeners", async () => { - const finishedExecution = deferred(); - - const ws = new Writable({ - write(_data, _env, cb) { - cb(); - }, - }); - - const removeListener = finished(ws, () => { - finishedExecution.reject(); - }); - removeListener(); - ws.end(); - - await Promise.race([ - delay(100), - finishedExecution, - ]) - .catch(() => fail("Finished was executed")); -}); |