diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/053_import_compression/brotli.header | 3 | ||||
-rw-r--r-- | cli/tests/053_import_compression/gziped.header | 3 | ||||
-rw-r--r-- | cli/tests/integration_tests.rs | 3 | ||||
-rw-r--r-- | cli/tests/unit/README.md | 6 | ||||
-rw-r--r-- | cli/tests/unit/body_test.ts | 2 | ||||
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 50 | ||||
-rw-r--r-- | cli/tests/x_deno_warning.js.header | 2 |
7 files changed, 27 insertions, 42 deletions
diff --git a/cli/tests/053_import_compression/brotli.header b/cli/tests/053_import_compression/brotli.header deleted file mode 100644 index 6047a3993..000000000 --- a/cli/tests/053_import_compression/brotli.header +++ /dev/null @@ -1,3 +0,0 @@ -Content-Encoding: br -Content-Type: application/javascript -Content-Length: 26
\ No newline at end of file diff --git a/cli/tests/053_import_compression/gziped.header b/cli/tests/053_import_compression/gziped.header deleted file mode 100644 index fda818af6..000000000 --- a/cli/tests/053_import_compression/gziped.header +++ /dev/null @@ -1,3 +0,0 @@ -Content-Encoding: gzip -Content-Type: application/javascript -Content-Length: 39
\ No newline at end of file diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 6855df707..616849520 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -2600,7 +2600,8 @@ fn test_permissions_net_listen_allow_localhost_4555_fail() { #[test] fn test_permissions_net_listen_allow_localhost() { - // Port 4600 is chosen to not colide with those used by tools/http_server.py + // Port 4600 is chosen to not colide with those used by + // target/debug/test_server let (_, err) = util::run_and_collect_output( true, "run --allow-net=localhost complex_permissions_test.ts netListen localhost:4600", diff --git a/cli/tests/unit/README.md b/cli/tests/unit/README.md index c333b0046..1546038c4 100644 --- a/cli/tests/unit/README.md +++ b/cli/tests/unit/README.md @@ -75,6 +75,6 @@ RUST_BACKTRACE=1 cargo run -- run --unstable --allow-read --allow-write cli/test ### Http server -`tools/http_server.py` is required to run when one's running unit tests. During -CI it's spawned automatically, but if you want to run tests manually make sure -that server is spawned otherwise there'll be cascade of test failures. +`target/debug/test_server` is required to run when one's running unit tests. +During CI it's spawned automatically, but if you want to run tests manually make +sure that server is spawned otherwise there'll be cascade of test failures. diff --git a/cli/tests/unit/body_test.ts b/cli/tests/unit/body_test.ts index d0423f7de..3b01190a6 100644 --- a/cli/tests/unit/body_test.ts +++ b/cli/tests/unit/body_test.ts @@ -36,7 +36,7 @@ unitTest( { perms: { net: true } }, async function bodyMultipartFormData(): Promise<void> { const response = await fetch( - "http://localhost:4545/cli/tests/subdir/multipart_form_data.txt" + "http://localhost:4545/multipart_form_data.txt" ); const text = await response.text(); diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index a52a7809a..1dab8f7f9 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -67,7 +67,6 @@ unitTest({ perms: { net: true } }, async function fetchHeaders(): Promise< 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")); const _json = await response.json(); }); @@ -162,13 +161,10 @@ unitTest( { perms: { net: true } }, async function fetchBodyReaderBigBody(): Promise<void> { const data = "a".repeat(10 << 10); // 10mb - const response = await fetch( - "http://localhost:4545/cli/tests/echo_server", - { - method: "POST", - body: data, - } - ); + const response = await fetch("http://localhost:4545/echo_server", { + method: "POST", + body: data, + }); assert(response.body !== null); const reader = await response.body.getReader(); let total = 0; @@ -210,7 +206,7 @@ unitTest( { perms: { net: true } }, async function fetchMultipartFormDataSuccess(): Promise<void> { const response = await fetch( - "http://localhost:4545/cli/tests/subdir/multipart_form_data.txt" + "http://localhost:4545/multipart_form_data.txt" ); const formData = await response.formData(); assert(formData.has("field_1")); @@ -315,12 +311,12 @@ unitTest( perms: { net: true }, }, async function fetchWithRedirection(): Promise<void> { - const response = await fetch("http://localhost:4546/"); // will redirect to http://localhost:4545/ + const response = await fetch("http://localhost:4546/README.md"); assertEquals(response.status, 200); assertEquals(response.statusText, "OK"); - assertEquals(response.url, "http://localhost:4545/"); + assertEquals(response.url, "http://localhost:4545/README.md"); const body = await response.text(); - assert(body.includes("<title>Directory listing for /</title>")); + assert(body.includes("Deno")); } ); @@ -329,11 +325,13 @@ unitTest( perms: { net: true }, }, async function fetchWithRelativeRedirection(): Promise<void> { - const response = await fetch("http://localhost:4545/cli/tests"); // will redirect to /cli/tests/ + const response = await fetch( + "http://localhost:4545/cli/tests/001_hello.js" + ); assertEquals(response.status, 200); assertEquals(response.statusText, "OK"); const body = await response.text(); - assert(body.includes("<title>Directory listing for /cli/tests/</title>")); + assert(body.includes("Hello")); } ); @@ -769,13 +767,10 @@ unitTest( { perms: { net: true } }, async function fetchBodyReaderWithCancelAndNewReader(): Promise<void> { const data = "a".repeat(1 << 10); - const response = await fetch( - "http://localhost:4545/cli/tests/echo_server", - { - method: "POST", - body: data, - } - ); + const response = await fetch("http://localhost:4545/echo_server", { + method: "POST", + body: data, + }); assert(response.body !== null); const firstReader = await response.body.getReader(); @@ -801,13 +796,10 @@ unitTest( async function fetchBodyReaderWithReadCancelAndNewReader(): Promise<void> { const data = "a".repeat(1 << 10); - const response = await fetch( - "http://localhost:4545/cli/tests/echo_server", - { - method: "POST", - body: data, - } - ); + const response = await fetch("http://localhost:4545/echo_server", { + method: "POST", + body: data, + }); assert(response.body !== null); const firstReader = await response.body.getReader(); @@ -848,7 +840,7 @@ unitTest( for (const status of nullBodyStatus) { const headers = new Headers([["x-status", String(status)]]); - const res = await fetch("http://localhost:4545/cli/tests/echo_server", { + const res = await fetch("http://localhost:4545/echo_server", { body: "deno", method: "POST", headers, diff --git a/cli/tests/x_deno_warning.js.header b/cli/tests/x_deno_warning.js.header deleted file mode 100644 index 9a8ba0190..000000000 --- a/cli/tests/x_deno_warning.js.header +++ /dev/null @@ -1,2 +0,0 @@ -Content-Type: application/javascript -X-Deno-Warning: foobar
\ No newline at end of file |