1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

test to check that resource handle is closed after stream is cancelled (#5956)

This commit is contained in:
Marcos Casagrande 2020-05-30 07:02:41 +02:00 committed by GitHub
parent 24e545d5bd
commit a82f24e9a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();
}
);