1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-23 15:16:54 -05:00
denoland-deno/cli/tests/unit_node/stream_test.ts
Yoshiya Hinosawa 7d8f0ae038
chore(ext/node): remove unnecessary test case (#21337)
This test case is covered by the last case in
5710fffb12/cli/tests/node_compat/test/parallel/test-stream2-transform.js
and not necessary anymore.
2023-11-25 12:20:47 +09:00

25 lines
857 B
TypeScript

// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { assert } from "../../../test_util/std/testing/asserts.ts";
import { fromFileUrl, relative } from "../../../test_util/std/path/mod.ts";
import { pipeline } from "node:stream/promises";
import { createReadStream, createWriteStream } from "node:fs";
Deno.test("stream/promises pipeline", async () => {
const filePath = relative(
Deno.cwd(),
fromFileUrl(new URL("./testdata/lorem_ipsum.txt", import.meta.url)),
);
const input = createReadStream(filePath);
const output = createWriteStream("lorem_ipsum.txt.copy");
await pipeline(input, output);
const content = Deno.readTextFileSync("lorem_ipsum.txt.copy");
assert(content.startsWith("Lorem ipsum dolor sit amet"));
try {
Deno.removeSync("lorem_ipsum.txt.copy");
} catch {
// pass
}
});