summaryrefslogtreecommitdiff
path: root/tests/unit_node
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit_node')
-rw-r--r--tests/unit_node/fetch_test.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit_node/fetch_test.ts b/tests/unit_node/fetch_test.ts
new file mode 100644
index 000000000..399d6052a
--- /dev/null
+++ b/tests/unit_node/fetch_test.ts
@@ -0,0 +1,18 @@
+// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+
+import { assertEquals } from "@std/assert";
+import { createReadStream } from "node:fs";
+
+Deno.test("fetch node stream", async () => {
+ const file = createReadStream("tests/testdata/assets/fixture.json");
+
+ const response = await fetch("http://localhost:4545/echo_server", {
+ method: "POST",
+ body: file,
+ });
+
+ assertEquals(
+ await response.text(),
+ await Deno.readTextFile("tests/testdata/assets/fixture.json"),
+ );
+});