Skip to content

Commit

Permalink
refactor: port fetch test to rust (#3887)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukahartwig authored Feb 4, 2020
1 parent 184be99 commit 7d115a2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 34 deletions.
29 changes: 27 additions & 2 deletions cli/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,36 @@ fn deno_dir_test() {
drop(g);
}

// TODO(#2933): Rewrite this test in rust.
#[test]
fn fetch_test() {
pub use deno::test_util::*;
use std::process::Command;
use tempfile::TempDir;

let g = util::http_server();
util::run_python_script("tools/fetch_test.py");

let deno_dir = TempDir::new().expect("tempdir fail");
let t = util::root_path().join("cli/tests/006_url_imports.ts");

let output = Command::new(deno_exe_path())
.env("DENO_DIR", deno_dir.path())
.current_dir(util::root_path())
.arg("fetch")
.arg(t)
.output()
.expect("Failed to spawn script");

let code = output.status.code();
let out = std::str::from_utf8(&output.stdout).unwrap();

assert_eq!(Some(0), code);
assert_eq!(out, "");

let expected_path = deno_dir
.path()
.join("deps/http/localhost_PORT4545/cli/tests/subdir/mod2.ts");
assert_eq!(expected_path.exists(), true);

drop(g);
}

Expand Down
32 changes: 0 additions & 32 deletions tools/fetch_test.py

This file was deleted.

0 comments on commit 7d115a2

Please sign in to comment.