diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-08-16 00:30:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-15 23:30:06 +0000 |
commit | b6c74aab240430fa70c057be825ce766d2314e02 (patch) | |
tree | 6e2b3f690411f41de77972339f4145d2c85b31b8 /tests/unit/resources_test.ts | |
parent | a58494483a2c618636697e05f9c799b03e405056 (diff) |
Revert "test: run unit tests with DENO_FUTURE=1 (#24400)" (#25060)
This reverts commit 22a834ff5b4b312b8f91be8991f2b495d49fad2f.
Appears this commit might have broken tests on `main`.
Diffstat (limited to 'tests/unit/resources_test.ts')
-rw-r--r-- | tests/unit/resources_test.ts | 83 |
1 files changed, 36 insertions, 47 deletions
diff --git a/tests/unit/resources_test.ts b/tests/unit/resources_test.ts index ec7f5bc5b..921a8af8f 100644 --- a/tests/unit/resources_test.ts +++ b/tests/unit/resources_test.ts @@ -2,12 +2,7 @@ // deno-lint-ignore-file no-deprecated-deno-api -import { - assert, - assertEquals, - assertThrows, - DENO_FUTURE, -} from "./test_util.ts"; +import { assert, assertEquals, assertThrows } from "./test_util.ts"; const listenPort = 4505; @@ -17,7 +12,7 @@ Deno.test(function resourcesCloseBadArgs() { }, TypeError); }); -Deno.test({ ignore: DENO_FUTURE }, function resourcesStdio() { +Deno.test(function resourcesStdio() { const res = Deno.resources(); assertEquals(res[0], "stdin"); @@ -25,45 +20,39 @@ Deno.test({ ignore: DENO_FUTURE }, function resourcesStdio() { assertEquals(res[2], "stderr"); }); -Deno.test( - { ignore: DENO_FUTURE, permissions: { net: true } }, - async function resourcesNet() { - const listener = Deno.listen({ port: listenPort }); - const dialerConn = await Deno.connect({ port: listenPort }); - const listenerConn = await listener.accept(); +Deno.test({ permissions: { net: true } }, async function resourcesNet() { + const listener = Deno.listen({ port: listenPort }); + const dialerConn = await Deno.connect({ port: listenPort }); + const listenerConn = await listener.accept(); - const res = Deno.resources(); - assertEquals( - Object.values(res).filter((r): boolean => r === "tcpListener").length, - 1, - ); - const tcpStreams = Object.values(res).filter( - (r): boolean => r === "tcpStream", - ); - assert(tcpStreams.length >= 2); - - listenerConn.close(); - dialerConn.close(); - listener.close(); - }, -); - -Deno.test( - { ignore: DENO_FUTURE, permissions: { read: true } }, - async function resourcesFile() { - const resourcesBefore = Deno.resources(); - const f = await Deno.open("tests/testdata/assets/hello.txt"); - const resourcesAfter = Deno.resources(); - f.close(); + const res = Deno.resources(); + assertEquals( + Object.values(res).filter((r): boolean => r === "tcpListener").length, + 1, + ); + const tcpStreams = Object.values(res).filter( + (r): boolean => r === "tcpStream", + ); + assert(tcpStreams.length >= 2); + + listenerConn.close(); + dialerConn.close(); + listener.close(); +}); - // check that exactly one new resource (file) was added - assertEquals( - Object.keys(resourcesAfter).length, - Object.keys(resourcesBefore).length + 1, - ); - const newRid = +Object.keys(resourcesAfter).find((rid): boolean => { - return !Object.prototype.hasOwnProperty.call(resourcesBefore, rid); - })!; - assertEquals(resourcesAfter[newRid], "fsFile"); - }, -); +Deno.test({ permissions: { read: true } }, async function resourcesFile() { + const resourcesBefore = Deno.resources(); + const f = await Deno.open("tests/testdata/assets/hello.txt"); + const resourcesAfter = Deno.resources(); + f.close(); + + // check that exactly one new resource (file) was added + assertEquals( + Object.keys(resourcesAfter).length, + Object.keys(resourcesBefore).length + 1, + ); + const newRid = +Object.keys(resourcesAfter).find((rid): boolean => { + return !Object.prototype.hasOwnProperty.call(resourcesBefore, rid); + })!; + assertEquals(resourcesAfter[newRid], "fsFile"); +}); |