summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-02-19 08:17:13 -0500
committerGitHub <noreply@github.com>2020-02-19 08:17:13 -0500
commit852823fa505d75d61e70e1330bbf366aa248e650 (patch)
tree371f39e954c6b8169ed9fd1f96d022e13e185aa8 /cli/tests
parent046bbb26913f9da58b0d23ae331e9dab9dc19e59 (diff)
refactor: rewrite HTTP cache for file fetcher (#4030)
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/022_info_flag_script.out2
-rw-r--r--cli/tests/049_info_flag_script_jsx.out2
-rw-r--r--cli/tests/cafile_info.ts.out2
-rw-r--r--cli/tests/integration_tests.rs21
4 files changed, 18 insertions, 9 deletions
diff --git a/cli/tests/022_info_flag_script.out b/cli/tests/022_info_flag_script.out
index 48eef7365..14580839e 100644
--- a/cli/tests/022_info_flag_script.out
+++ b/cli/tests/022_info_flag_script.out
@@ -1,4 +1,4 @@
-local: [WILDCARD]019_media_types.ts
+local: [WILDCARD]http[WILDCARD]127.0.0.1_PORT4545[WILDCARD]
type: TypeScript
compiled: [WILDCARD].js
map: [WILDCARD].js.map
diff --git a/cli/tests/049_info_flag_script_jsx.out b/cli/tests/049_info_flag_script_jsx.out
index 48f5efa9e..135a830ad 100644
--- a/cli/tests/049_info_flag_script_jsx.out
+++ b/cli/tests/049_info_flag_script_jsx.out
@@ -1,4 +1,4 @@
-local: [WILDCARD]048_media_types_jsx.ts
+local: [WILDCARD]http[WILDCARD]127.0.0.1_PORT4545[WILDCARD]
type: TypeScript
compiled: [WILDCARD]048_media_types_jsx.ts.js
map: [WILDCARD]048_media_types_jsx.ts.js.map
diff --git a/cli/tests/cafile_info.ts.out b/cli/tests/cafile_info.ts.out
index 443b92eea..c50990705 100644
--- a/cli/tests/cafile_info.ts.out
+++ b/cli/tests/cafile_info.ts.out
@@ -1,4 +1,4 @@
-local: [WILDCARD]cafile_info.ts
+local: [WILDCARD]https[WILDCARD]localhost_PORT5545[WILDCARD]
type: TypeScript
compiled: [WILDCARD].js
map: [WILDCARD].js.map
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index ebb0349c5..bfe5794f5 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -23,20 +23,23 @@ fn deno_dir_test() {
#[test]
fn fetch_test() {
+ use deno::http_cache::url_to_filename;
pub use deno::test_util::*;
use std::process::Command;
use tempfile::TempDir;
+ use url::Url;
let g = util::http_server();
let deno_dir = TempDir::new().expect("tempdir fail");
- let t = util::root_path().join("cli/tests/006_url_imports.ts");
+ let module_url =
+ Url::parse("http://localhost:4545/cli/tests/006_url_imports.ts").unwrap();
let output = Command::new(deno_exe_path())
.env("DENO_DIR", deno_dir.path())
.current_dir(util::root_path())
.arg("fetch")
- .arg(t)
+ .arg(module_url.to_string())
.output()
.expect("Failed to spawn script");
@@ -48,7 +51,8 @@ fn fetch_test() {
let expected_path = deno_dir
.path()
- .join("deps/http/localhost_PORT4545/cli/tests/subdir/mod2.ts");
+ .join("deps")
+ .join(url_to_filename(&module_url));
assert_eq!(expected_path.exists(), true);
drop(g);
@@ -966,14 +970,18 @@ itest!(cafile_info {
#[test]
fn cafile_fetch() {
+ use deno::http_cache::url_to_filename;
pub use deno::test_util::*;
use std::process::Command;
use tempfile::TempDir;
+ use url::Url;
let g = util::http_server();
let deno_dir = TempDir::new().expect("tempdir fail");
- let t = util::root_path().join("cli/tests/cafile_url_imports.ts");
+ let module_url =
+ Url::parse("http://localhost:4545/cli/tests/cafile_url_imports.ts")
+ .unwrap();
let cafile = util::root_path().join("cli/tests/tls/RootCA.pem");
let output = Command::new(deno_exe_path())
.env("DENO_DIR", deno_dir.path())
@@ -981,7 +989,7 @@ fn cafile_fetch() {
.arg("fetch")
.arg("--cert")
.arg(cafile)
- .arg(t)
+ .arg(module_url.to_string())
.output()
.expect("Failed to spawn script");
@@ -993,7 +1001,8 @@ fn cafile_fetch() {
let expected_path = deno_dir
.path()
- .join("deps/https/localhost_PORT5545/cli/tests/subdir/mod2.ts");
+ .join("deps")
+ .join(url_to_filename(&module_url));
assert_eq!(expected_path.exists(), true);
drop(g);