summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/lsp_tests.rs48
-rw-r--r--cli/tests/testdata/import_maps/import_map.json1
-rw-r--r--cli/tests/testdata/import_maps/print_hello.ts3
3 files changed, 52 insertions, 0 deletions
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs
index 44a5df700..9e9b3f8cd 100644
--- a/cli/tests/integration/lsp_tests.rs
+++ b/cli/tests/integration/lsp_tests.rs
@@ -207,6 +207,54 @@ fn lsp_import_map() {
}
#[test]
+fn lsp_import_map_remote() {
+ let context = TestContextBuilder::new()
+ .use_http_server()
+ .use_temp_cwd()
+ .build();
+ let temp_dir = context.temp_dir();
+ temp_dir.write(
+ "deno.json",
+ json!({
+ "importMap": "http://localhost:4545/import_maps/import_map.json",
+ })
+ .to_string(),
+ );
+ temp_dir.write(
+ "file.ts",
+ r#"
+ import { printHello } from "print_hello";
+ printHello();
+ "#,
+ );
+ let mut client = context.new_lsp_command().build();
+ client.initialize(|builder| {
+ builder.set_import_map("http://localhost:4545/import_maps/import_map.json");
+ });
+ client.write_request(
+ "workspace/executeCommand",
+ json!({
+ "command": "deno.cache",
+ "arguments": [
+ [],
+ temp_dir.uri().join("file.ts").unwrap(),
+ ],
+ }),
+ );
+
+ let diagnostics = client.did_open(json!({
+ "textDocument": {
+ "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "languageId": "typescript",
+ "version": 1,
+ "text": temp_dir.read_to_string("file.ts"),
+ }
+ }));
+ assert_eq!(diagnostics.all(), vec![]);
+ client.shutdown();
+}
+
+#[test]
fn lsp_import_map_data_url() {
let context = TestContextBuilder::new().use_temp_cwd().build();
let mut client = context.new_lsp_command().build();
diff --git a/cli/tests/testdata/import_maps/import_map.json b/cli/tests/testdata/import_maps/import_map.json
index 601874aab..40d1d4ec2 100644
--- a/cli/tests/testdata/import_maps/import_map.json
+++ b/cli/tests/testdata/import_maps/import_map.json
@@ -1,5 +1,6 @@
{
"imports": {
+ "print_hello": "./print_hello.ts",
"moment": "./moment/moment.ts",
"moment/": "./moment/",
"lodash": "./lodash/lodash.ts",
diff --git a/cli/tests/testdata/import_maps/print_hello.ts b/cli/tests/testdata/import_maps/print_hello.ts
new file mode 100644
index 000000000..794257390
--- /dev/null
+++ b/cli/tests/testdata/import_maps/print_hello.ts
@@ -0,0 +1,3 @@
+export function printHello() {
+ console.log("Hello, world!");
+}