From a05e890d566979ead5f94ef9c897c0fa5b0bfdc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 1 Aug 2023 03:31:30 +0200 Subject: [PATCH] chore: make LSP test less prone to changes (#20003) This test was getting changed often, I modified it a bit so it's less sensitive to changes in declaration files. --- cli/tests/integration/lsp_tests.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs index 22951825b1..a1a2b02584 100644 --- a/cli/tests/integration/lsp_tests.rs +++ b/cli/tests/integration/lsp_tests.rs @@ -5108,9 +5108,12 @@ fn lsp_completions_auto_import() { ); assert!(!list.is_incomplete); let item = list.items.iter().find(|item| item.label == "foo"); - if item.is_none() { + let Some(item) = item else { panic!("completions items missing 'foo' symbol"); - } + }; + let mut item_value = serde_json::to_value(item).unwrap(); + item_value["data"]["tsc"]["data"]["exportMapKey"] = + serde_json::Value::String("".to_string()); let req = json!({ "label": "foo", @@ -5130,7 +5133,7 @@ fn lsp_completions_auto_import() { "source": "./b.ts", "data": { "exportName": "foo", - "exportMapKey": "foo|6811|file:///a/b", + "exportMapKey": "", "moduleSpecifier": "./b.ts", "fileName": "file:///a/b.ts" }, @@ -5138,7 +5141,7 @@ fn lsp_completions_auto_import() { } } }); - assert_eq!(serde_json::to_value(item.unwrap()).unwrap(), req); + assert_eq!(item_value, req); let res = client.write_request("completionItem/resolve", req); assert_eq!(