From ca424a1eda666a0778afedb96c9b5eb817da76d3 Mon Sep 17 00:00:00 2001 From: Wolmir Nemitz <wolmir.nemitz@gmail.com> Date: Mon, 3 Oct 2022 13:47:12 -0300 Subject: [PATCH] Add more tests --- languageServer/src/documentSelector.ts | 17 ----------------- languageServer/src/test/definitions.test.ts | 7 +++++-- .../src/test/fixtures/examples/valid/index.ts | 1 + .../test/utils/openTheseFilesAndNotifyServer.ts | 2 +- 4 files changed, 7 insertions(+), 20 deletions(-) delete mode 100644 languageServer/src/documentSelector.ts diff --git a/languageServer/src/documentSelector.ts b/languageServer/src/documentSelector.ts deleted file mode 100644 index bf3ee5131b..0000000000 --- a/languageServer/src/documentSelector.ts +++ /dev/null @@ -1,17 +0,0 @@ -export const documentSelector = [ - { - language: 'yaml' - }, - { - pattern: '**/*.{dvc,dvc.lock}' - }, - { - language: 'json' - }, - { - language: 'toml' - }, - { - language: 'python' - } -] diff --git a/languageServer/src/test/definitions.test.ts b/languageServer/src/test/definitions.test.ts index 2187bf49f4..37100204e8 100644 --- a/languageServer/src/test/definitions.test.ts +++ b/languageServer/src/test/definitions.test.ts @@ -104,12 +104,16 @@ describe('textDocument/definitions', () => { languageId: 'json', mockContents: '', mockPath: 'moreParams/otherParams.json' + }, + { + languageId: 'blankLang', + mockContents: '', + mockPath: 'data/blankFile' } ]) let response = await requestDefinitions(dvcYaml, 'params.json') - expect(response).toBeTruthy() expect(response).toStrictEqual({ range: Range.create(Position.create(0, 0), Position.create(0, 0)), uri: 'file:///params.json' @@ -117,7 +121,6 @@ describe('textDocument/definitions', () => { response = await requestDefinitions(dvcYaml, 'otherParams.json') - expect(response).toBeTruthy() expect(response).toStrictEqual({ range: Range.create(Position.create(0, 0), Position.create(0, 0)), uri: 'file:///moreParams/otherParams.json' diff --git a/languageServer/src/test/fixtures/examples/valid/index.ts b/languageServer/src/test/fixtures/examples/valid/index.ts index 1bf7066e3d..f5783be640 100644 --- a/languageServer/src/test/fixtures/examples/valid/index.ts +++ b/languageServer/src/test/fixtures/examples/valid/index.ts @@ -77,6 +77,7 @@ stages: params: - params.json - moreParams/otherParams.json + - data/blankFile stage2: cmd: - echo hello diff --git a/languageServer/src/test/utils/openTheseFilesAndNotifyServer.ts b/languageServer/src/test/utils/openTheseFilesAndNotifyServer.ts index 1134ca0d12..666af91a08 100644 --- a/languageServer/src/test/utils/openTheseFilesAndNotifyServer.ts +++ b/languageServer/src/test/utils/openTheseFilesAndNotifyServer.ts @@ -13,7 +13,7 @@ export const openTheseFilesAndNotifyServer = async ( const textDocument = TextDocument.create(uri, languageId, 1, mockContents) await client.sendNotification(DidOpenTextDocumentNotification.type, { textDocument: { - languageId: 'yaml', + languageId, text: textDocument.getText(), uri: textDocument.uri, version: textDocument.version