mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
Add test.
This commit is contained in:
parent
e92d7add38
commit
7c0bbaada1
1 changed files with 49 additions and 0 deletions
49
cli/tools/vendor/build.rs
vendored
49
cli/tools/vendor/build.rs
vendored
|
@ -378,6 +378,55 @@ mod test {
|
|||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn remote_url_no_path() {
|
||||
let mut builder = VendorTestBuilder::with_default_setup();
|
||||
let output = builder
|
||||
.with_loader(|loader| {
|
||||
loader
|
||||
.add(
|
||||
"/mod.ts",
|
||||
concat!(
|
||||
r#"import "https://localhost";"#,
|
||||
r#"import "https://localhost/subdir/mod.ts";"#,
|
||||
),
|
||||
)
|
||||
.add_with_headers(
|
||||
"https://localhost",
|
||||
"import './subdir'; export class Mod1 {}",
|
||||
&[("content-type", "application/typescript")],
|
||||
)
|
||||
.add_with_headers(
|
||||
"https://localhost/subdir",
|
||||
"import './subdir/mod.ts'; export class Mod2 {}",
|
||||
&[("content-type", "application/typescript")],
|
||||
)
|
||||
.add("https://localhost/subdir/mod.ts", "export class Mod3 {}");
|
||||
})
|
||||
.build()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
output.import_map,
|
||||
Some(json!({
|
||||
"imports": {
|
||||
"https://localhost/": "./localhost/",
|
||||
"https://localhost": "./localhost/root.ts",
|
||||
"https://localhost/subdir": "./localhost/subdir/root.ts",
|
||||
}
|
||||
}))
|
||||
);
|
||||
assert_eq!(
|
||||
output.files,
|
||||
to_file_vec(&[
|
||||
("/vendor/localhost/root.ts", "export class Mod1 {}"),
|
||||
("/vendor/localhost/subdir/root.ts", "export class Mod2 {}"),
|
||||
("/vendor/localhost/subdir/mod.ts", "export class Mod3 {}"),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn same_target_filename_specifiers() {
|
||||
let mut builder = VendorTestBuilder::with_default_setup();
|
||||
|
|
Loading…
Reference in a new issue