summaryrefslogtreecommitdiff
path: root/cli/tests/unit/fetch_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit/fetch_test.ts')
-rw-r--r--cli/tests/unit/fetch_test.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts
index 2738eba5e..6dfb23390 100644
--- a/cli/tests/unit/fetch_test.ts
+++ b/cli/tests/unit/fetch_test.ts
@@ -702,3 +702,15 @@ unitTest(
assertEquals(total, data.length);
}
);
+
+unitTest(
+ { perms: { net: true } },
+ async function fetchResourceCloseAfterStreamCancel(): Promise<void> {
+ const res = await fetch("http://localhost:4545/cli/tests/fixture.json");
+ assert(res.body !== null);
+
+ // After ReadableStream.cancel is called, resource handle must be closed
+ // The test should not fail with: Test case is leaking resources
+ await res.body.cancel();
+ }
+);