Skip to content

Commit

Permalink
Make existing tests work again
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkassimo committed Apr 1, 2019
1 parent eb68833 commit ab4e27e
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 15 deletions.
14 changes: 6 additions & 8 deletions cli/deno_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ impl DenoDir {
module_name: &str,
filename: &str,
) -> impl Future<Item = Option<ModuleMetaData>, Error = DenoError> {
use http_util::FetchOnceResult;
use crate::http_util::FetchOnceResult;
{
eprintln!("Downloading {}", module_name);
}
Expand Down Expand Up @@ -768,8 +768,9 @@ fn save_source_metadata(
// Had trouble to make serde_derive work: I'm unable to build proc-macro2.
let mut value_map = serde_json::map::Map::new();
if mime_type.is_some() {
let mime_type_string = mime_type.unwrap();
let resolved_mime_type = { extmap(&mime_type_string) };
let mime_type_string = mime_type.clone().unwrap();
let resolved_mime_type =
{ map_content_type(Path::new(""), Some(mime_type_string.as_str())) };
let ext = p
.extension()
.map(|x| x.to_str().unwrap_or(""))
Expand Down Expand Up @@ -1020,7 +1021,7 @@ mod tests {
// Mismatch ext with content type, create .meta
assert_eq!(&(r.media_type), &msg::MediaType::JavaScript);
assert_eq!(
get_source_metadata(&metadata_file_name).mime_type.unwrap(),
get_source_metadata(&filename).mime_type.unwrap(),
"text/javascript"
);

Expand All @@ -1034,10 +1035,7 @@ mod tests {
// If get_source_code does not call remote, this should be TypeScript
// as we modified before! (we do not overwrite .meta due to no http fetch)
assert_eq!(&(r2.media_type), &msg::MediaType::TypeScript);
assert_eq!(
get_source_metadata(&filename).mime_type.unwrap(),
"text/typescript"
);
assert!(fs::read_to_string(&metadata_file_name).is_err());

// Don't use_cache
let result3 = deno_dir.get_source_code(module_name, &filename, false);
Expand Down
2 changes: 1 addition & 1 deletion cli/http_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,5 @@ fn test_resolve_uri_from_location_relative_3() {
let url = "http://deno.land/x".parse::<Uri>().unwrap();
let new_uri = resolve_uri_from_location(&url, "z");
assert_eq!(new_uri.host().unwrap(), "deno.land");
assert_eq!(new_uri.path(), "/x/z");
assert_eq!(new_uri.path(), "/z");
}
File renamed without changes.
1 change: 1 addition & 0 deletions tests/023_no_ext_with_meta.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"mime_type":"application/javascript"}
File renamed without changes.
2 changes: 2 additions & 0 deletions tests/023_no_ext_with_meta.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
args: tests/023_no_ext_with_meta --reload
output: tests/023_no_ext_with_meta.out
1 change: 0 additions & 1 deletion tests/023_no_ext_with_mime.mime

This file was deleted.

2 changes: 0 additions & 2 deletions tests/023_no_ext_with_mime.test

This file was deleted.

2 changes: 2 additions & 0 deletions tests/024_import_no_ext_with_meta.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
args: tests/024_import_no_ext_with_meta.ts --reload
output: tests/024_import_no_ext_with_meta.ts.out
1 change: 1 addition & 0 deletions tests/024_import_no_ext_with_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./023_no_ext_with_meta";
File renamed without changes.
2 changes: 0 additions & 2 deletions tests/024_import_no_ext_with_mime.test

This file was deleted.

1 change: 0 additions & 1 deletion tests/024_import_no_ext_with_mime.ts

This file was deleted.

0 comments on commit ab4e27e

Please sign in to comment.