diff options
Diffstat (limited to 'cli/js')
-rw-r--r-- | cli/js/fetch_test.ts | 18 | ||||
-rw-r--r-- | cli/js/files_test.ts | 4 | ||||
-rw-r--r-- | cli/js/read_dir_test.ts | 2 | ||||
-rw-r--r-- | cli/js/read_file_test.ts | 8 | ||||
-rw-r--r-- | cli/js/stat_test.ts | 24 |
5 files changed, 28 insertions, 28 deletions
diff --git a/cli/js/fetch_test.ts b/cli/js/fetch_test.ts index 56c693681..1b9450dcd 100644 --- a/cli/js/fetch_test.ts +++ b/cli/js/fetch_test.ts @@ -21,7 +21,7 @@ testPerm({ net: true }, async function fetchConnectionError(): Promise<void> { }); testPerm({ net: true }, async function fetchJsonSuccess(): Promise<void> { - const response = await fetch("http://localhost:4545/package.json"); + const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); const json = await response.json(); assertEquals(json.name, "deno"); }); @@ -29,7 +29,7 @@ testPerm({ net: true }, async function fetchJsonSuccess(): Promise<void> { test(async function fetchPerm(): Promise<void> { let err; try { - await fetch("http://localhost:4545/package.json"); + await fetch("http://localhost:4545/cli/tests/fixture.json"); } catch (err_) { err = err_; } @@ -38,19 +38,19 @@ test(async function fetchPerm(): Promise<void> { }); testPerm({ net: true }, async function fetchUrl(): Promise<void> { - const response = await fetch("http://localhost:4545/package.json"); - assertEquals(response.url, "http://localhost:4545/package.json"); + const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); + assertEquals(response.url, "http://localhost:4545/cli/tests/fixture.json"); }); testPerm({ net: true }, async function fetchHeaders(): Promise<void> { - const response = await fetch("http://localhost:4545/package.json"); + const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); const headers = response.headers; assertEquals(headers.get("Content-Type"), "application/json"); assert(headers.get("Server").startsWith("SimpleHTTP")); }); testPerm({ net: true }, async function fetchBlob(): Promise<void> { - const response = await fetch("http://localhost:4545/package.json"); + const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); const headers = response.headers; const blob = await response.blob(); assertEquals(blob.type, headers.get("Content-Type")); @@ -58,7 +58,7 @@ testPerm({ net: true }, async function fetchBlob(): Promise<void> { }); testPerm({ net: true }, async function fetchBodyUsed(): Promise<void> { - const response = await fetch("http://localhost:4545/package.json"); + const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); assertEquals(response.bodyUsed, false); assertThrows( (): void => { @@ -71,7 +71,7 @@ testPerm({ net: true }, async function fetchBodyUsed(): Promise<void> { }); testPerm({ net: true }, async function fetchAsyncIterator(): Promise<void> { - const response = await fetch("http://localhost:4545/package.json"); + const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); const headers = response.headers; let total = 0; for await (const chunk of response.body) { @@ -82,7 +82,7 @@ testPerm({ net: true }, async function fetchAsyncIterator(): Promise<void> { }); testPerm({ net: true }, async function responseClone(): Promise<void> { - const response = await fetch("http://localhost:4545/package.json"); + const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); const response1 = response.clone(); assert(response !== response1); assertEquals(response.status, response1.status); diff --git a/cli/js/files_test.ts b/cli/js/files_test.ts index 004cb662b..2eaa3b9be 100644 --- a/cli/js/files_test.ts +++ b/cli/js/files_test.ts @@ -8,7 +8,7 @@ test(function filesStdioFileDescriptors(): void { }); testPerm({ read: true }, async function filesCopyToStdout(): Promise<void> { - const filename = "package.json"; + const filename = "cli/tests/fixture.json"; const file = await Deno.open(filename); assert(file.rid > 2); const bytesWritten = await Deno.copy(Deno.stdout, file); @@ -81,7 +81,7 @@ testPerm({ write: false }, async function writePermFailure(): Promise<void> { testPerm({ read: false }, async function readPermFailure(): Promise<void> { let caughtError = false; try { - await Deno.open("package.json", "r"); + await Deno.open("cli/tests/fixture.json", "r"); } catch (e) { caughtError = true; assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); diff --git a/cli/js/read_dir_test.ts b/cli/js/read_dir_test.ts index 3e11df9fe..f75aca996 100644 --- a/cli/js/read_dir_test.ts +++ b/cli/js/read_dir_test.ts @@ -43,7 +43,7 @@ testPerm({ read: true }, function readDirSyncNotDir(): void { let src; try { - src = Deno.readDirSync("package.json"); + src = Deno.readDirSync("cli/tests/fixture.json"); } catch (err) { caughtError = true; assertEquals(err.kind, Deno.ErrorKind.Other); diff --git a/cli/js/read_file_test.ts b/cli/js/read_file_test.ts index 7d4f4789c..a7ffec578 100644 --- a/cli/js/read_file_test.ts +++ b/cli/js/read_file_test.ts @@ -2,7 +2,7 @@ import { testPerm, assert, assertEquals } from "./test_util.ts"; testPerm({ read: true }, function readFileSyncSuccess(): void { - const data = Deno.readFileSync("package.json"); + const data = Deno.readFileSync("cli/tests/fixture.json"); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); const json = decoder.decode(data); @@ -13,7 +13,7 @@ testPerm({ read: true }, function readFileSyncSuccess(): void { testPerm({ read: false }, function readFileSyncPerm(): void { let caughtError = false; try { - Deno.readFileSync("package.json"); + Deno.readFileSync("cli/tests/fixture.json"); } catch (e) { caughtError = true; assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); @@ -36,7 +36,7 @@ testPerm({ read: true }, function readFileSyncNotFound(): void { }); testPerm({ read: true }, async function readFileSuccess(): Promise<void> { - const data = await Deno.readFile("package.json"); + const data = await Deno.readFile("cli/tests/fixture.json"); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); const json = decoder.decode(data); @@ -47,7 +47,7 @@ testPerm({ read: true }, async function readFileSuccess(): Promise<void> { testPerm({ read: false }, async function readFilePerm(): Promise<void> { let caughtError = false; try { - await Deno.readFile("package.json"); + await Deno.readFile("cli/tests/fixture.json"); } catch (e) { caughtError = true; assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); diff --git a/cli/js/stat_test.ts b/cli/js/stat_test.ts index 6c42b277c..38bd3f6c6 100644 --- a/cli/js/stat_test.ts +++ b/cli/js/stat_test.ts @@ -4,11 +4,11 @@ import { testPerm, assert, assertEquals } from "./test_util.ts"; // TODO Add tests for modified, accessed, and created fields once there is a way // to create temp files. testPerm({ read: true }, async function statSyncSuccess(): Promise<void> { - const packageInfo = Deno.statSync("package.json"); + const packageInfo = Deno.statSync("README.md"); assert(packageInfo.isFile()); assert(!packageInfo.isSymlink()); - const modulesInfo = Deno.statSync("node_modules"); + const modulesInfo = Deno.statSync("cli/tests/symlink_to_subdir"); assert(modulesInfo.isDirectory()); assert(!modulesInfo.isSymlink()); @@ -20,7 +20,7 @@ testPerm({ read: true }, async function statSyncSuccess(): Promise<void> { testPerm({ read: false }, async function statSyncPerm(): Promise<void> { let caughtError = false; try { - Deno.statSync("package.json"); + Deno.statSync("README.md"); } catch (e) { caughtError = true; assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); @@ -46,11 +46,11 @@ testPerm({ read: true }, async function statSyncNotFound(): Promise<void> { }); testPerm({ read: true }, async function lstatSyncSuccess(): Promise<void> { - const packageInfo = Deno.lstatSync("package.json"); + const packageInfo = Deno.lstatSync("README.md"); assert(packageInfo.isFile()); assert(!packageInfo.isSymlink()); - const modulesInfo = Deno.lstatSync("node_modules"); + const modulesInfo = Deno.lstatSync("cli/tests/symlink_to_subdir"); assert(!modulesInfo.isDirectory()); assert(modulesInfo.isSymlink()); @@ -62,7 +62,7 @@ testPerm({ read: true }, async function lstatSyncSuccess(): Promise<void> { testPerm({ read: false }, async function lstatSyncPerm(): Promise<void> { let caughtError = false; try { - Deno.lstatSync("package.json"); + Deno.lstatSync("README.md"); } catch (e) { caughtError = true; assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); @@ -88,11 +88,11 @@ testPerm({ read: true }, async function lstatSyncNotFound(): Promise<void> { }); testPerm({ read: true }, async function statSuccess(): Promise<void> { - const packageInfo = await Deno.stat("package.json"); + const packageInfo = await Deno.stat("README.md"); assert(packageInfo.isFile()); assert(!packageInfo.isSymlink()); - const modulesInfo = await Deno.stat("node_modules"); + const modulesInfo = await Deno.stat("cli/tests/symlink_to_subdir"); assert(modulesInfo.isDirectory()); assert(!modulesInfo.isSymlink()); @@ -104,7 +104,7 @@ testPerm({ read: true }, async function statSuccess(): Promise<void> { testPerm({ read: false }, async function statPerm(): Promise<void> { let caughtError = false; try { - await Deno.stat("package.json"); + await Deno.stat("README.md"); } catch (e) { caughtError = true; assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); @@ -130,11 +130,11 @@ testPerm({ read: true }, async function statNotFound(): Promise<void> { }); testPerm({ read: true }, async function lstatSuccess(): Promise<void> { - const packageInfo = await Deno.lstat("package.json"); + const packageInfo = await Deno.lstat("README.md"); assert(packageInfo.isFile()); assert(!packageInfo.isSymlink()); - const modulesInfo = await Deno.lstat("node_modules"); + const modulesInfo = await Deno.lstat("cli/tests/symlink_to_subdir"); assert(!modulesInfo.isDirectory()); assert(modulesInfo.isSymlink()); @@ -146,7 +146,7 @@ testPerm({ read: true }, async function lstatSuccess(): Promise<void> { testPerm({ read: false }, async function lstatPerm(): Promise<void> { let caughtError = false; try { - await Deno.lstat("package.json"); + await Deno.lstat("README.md"); } catch (e) { caughtError = true; assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); |