diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/unit/read_file_test.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/cli/tests/unit/read_file_test.ts b/cli/tests/unit/read_file_test.ts index 24cf6dccf..5761cb1cb 100644 --- a/cli/tests/unit/read_file_test.ts +++ b/cli/tests/unit/read_file_test.ts @@ -158,3 +158,29 @@ Deno.test( assert(data.byteLength > 0); }, ); + +Deno.test( + { permissions: { read: true } }, + async function readFileNotFoundErrorCode() { + try { + await Deno.readFile("definitely-not-found.json"); + } catch (e) { + assertEquals(e.code, "ENOENT"); + } + }, +); + +Deno.test( + { permissions: { read: true } }, + async function readFileIsDirectoryErrorCode() { + try { + await Deno.readFile("cli/tests/testdata/assets/"); + } catch (e) { + if (Deno.build.os === "windows") { + assertEquals(e.code, "ENOENT"); + } else { + assertEquals(e.code, "EISDIR"); + } + } + }, +); |