summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/lsp_tests.rs39
-rw-r--r--cli/tests/testdata/lsp/did_open_params_import_hover.json2
-rw-r--r--cli/tests/testdata/lsp/initialize_params_registry.json4
-rw-r--r--cli/tests/testdata/lsp/registries/deno-import-intellisense.json2
-rw-r--r--cli/tests/testdata/lsp/registries/doc_a_latest_mod.ts.json4
5 files changed, 47 insertions, 4 deletions
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs
index a3e1138b6..6a7002b49 100644
--- a/cli/tests/integration/lsp_tests.rs
+++ b/cli/tests/integration/lsp_tests.rs
@@ -3044,7 +3044,8 @@ fn lsp_cache_location() {
let _g = http_server();
let temp_dir = TempDir::new().expect("could not create temp dir");
let mut params: lsp::InitializeParams =
- serde_json::from_value(load_fixture("initialize_params.json")).unwrap();
+ serde_json::from_value(load_fixture("initialize_params_registry.json"))
+ .unwrap();
params.root_uri = Some(Url::from_file_path(temp_dir.path()).unwrap());
if let Some(Value::Object(mut map)) = params.initialization_options {
@@ -3075,7 +3076,7 @@ fn lsp_cache_location() {
load_fixture("did_open_params_import_hover.json"),
);
let diagnostics = diagnostics.into_iter().flat_map(|x| x.diagnostics);
- assert_eq!(diagnostics.count(), 12);
+ assert_eq!(diagnostics.count(), 14);
let (maybe_res, maybe_err) = client
.write_request::<_, _, Value>(
"deno/cache",
@@ -3123,6 +3124,40 @@ fn lsp_cache_location() {
}
}))
);
+ let (maybe_res, maybe_err) = client
+ .write_request::<_, _, Value>(
+ "textDocument/hover",
+ json!({
+ "textDocument": {
+ "uri": "file:///a/file.ts",
+ },
+ "position": {
+ "line": 7,
+ "character": 28
+ }
+ }),
+ )
+ .unwrap();
+ assert!(maybe_err.is_none());
+ assert_eq!(
+ maybe_res,
+ Some(json!({
+ "contents": {
+ "kind": "markdown",
+ "value": "**Resolved Dependency**\n\n**Code**: http&#8203;://localhost:4545/x/a/mod.ts\n\n\n---\n\n**a**\n\nmod.ts"
+ },
+ "range": {
+ "start": {
+ "line": 7,
+ "character": 19
+ },
+ "end": {
+ "line": 7,
+ "character": 53
+ }
+ }
+ }))
+ );
let cache_path = temp_dir.path().join(".cache");
assert!(cache_path.is_dir());
assert!(cache_path.join("gen").is_dir());
diff --git a/cli/tests/testdata/lsp/did_open_params_import_hover.json b/cli/tests/testdata/lsp/did_open_params_import_hover.json
index e054eef3e..a79ba0d7f 100644
--- a/cli/tests/testdata/lsp/did_open_params_import_hover.json
+++ b/cli/tests/testdata/lsp/did_open_params_import_hover.json
@@ -3,6 +3,6 @@
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
- "text": "import * as a from \"http://127.0.0.1:4545/xTypeScriptTypes.js\";\n// @deno-types=\"http://127.0.0.1:4545/type_definitions/foo.d.ts\"\nimport * as b from \"http://127.0.0.1:4545/type_definitions/foo.js\";\nimport * as c from \"http://127.0.0.1:4545/subdir/type_reference.js\";\nimport * as d from \"http://127.0.0.1:4545/subdir/mod1.ts\";\nimport * as e from \"data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=\";\nimport * as f from \"./file_01.ts\";\n\nconsole.log(a, b, c, d, e, f);\n"
+ "text": "import * as a from \"http://127.0.0.1:4545/xTypeScriptTypes.js\";\n// @deno-types=\"http://127.0.0.1:4545/type_definitions/foo.d.ts\"\nimport * as b from \"http://127.0.0.1:4545/type_definitions/foo.js\";\nimport * as c from \"http://127.0.0.1:4545/subdir/type_reference.js\";\nimport * as d from \"http://127.0.0.1:4545/subdir/mod1.ts\";\nimport * as e from \"data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=\";\nimport * as f from \"./file_01.ts\";\nimport * as g from \"http://localhost:4545/x/a/mod.ts\";\n\nconsole.log(a, b, c, d, e, f, g);\n"
}
}
diff --git a/cli/tests/testdata/lsp/initialize_params_registry.json b/cli/tests/testdata/lsp/initialize_params_registry.json
index 67559ebb3..286f6085f 100644
--- a/cli/tests/testdata/lsp/initialize_params_registry.json
+++ b/cli/tests/testdata/lsp/initialize_params_registry.json
@@ -10,8 +10,10 @@
"cache": null,
"codeLens": {
"implementations": true,
- "references": true
+ "references": true,
+ "test": true
},
+ "config": "",
"importMap": null,
"lint": true,
"suggest": {
diff --git a/cli/tests/testdata/lsp/registries/deno-import-intellisense.json b/cli/tests/testdata/lsp/registries/deno-import-intellisense.json
index 7fe514dc0..5fd87085e 100644
--- a/cli/tests/testdata/lsp/registries/deno-import-intellisense.json
+++ b/cli/tests/testdata/lsp/registries/deno-import-intellisense.json
@@ -16,6 +16,7 @@
},
{
"key": "path",
+ "documentation": "/lsp/registries/doc_${module}_${{version}}_${path}.json",
"url": "/lsp/registries/${module}_${{version}}_${path}.json"
}
]
@@ -30,6 +31,7 @@
},
{
"key": "path",
+ "documentation": "/lsp/registries/doc_${module}_latest_${path}.json",
"url": "/lsp/registries/${module}_latest_${path}.json"
}
]
diff --git a/cli/tests/testdata/lsp/registries/doc_a_latest_mod.ts.json b/cli/tests/testdata/lsp/registries/doc_a_latest_mod.ts.json
new file mode 100644
index 000000000..522f5b271
--- /dev/null
+++ b/cli/tests/testdata/lsp/registries/doc_a_latest_mod.ts.json
@@ -0,0 +1,4 @@
+{
+ "kind": "markdown",
+ "value": "**a**\n\nmod.ts"
+}