Skip to content

Commit

Permalink
Add test for file path symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
wolmir committed Sep 21, 2022
1 parent d7313b5 commit 7465318
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion languageServer/src/test/definitions.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { Position, Range } from 'vscode-languageserver/node'
import { foreach_dvc_yaml, params_dvc_yaml } from './fixtures/examples/valid'
import {
foreach_dvc_yaml,
params_dvc_yaml,
vars_dvc_yaml
} from './fixtures/examples/valid'
import { params } from './fixtures/params'
import { requestDefinitions } from './utils/requestDefinitions'
import { openTheseFilesAndNotifyServer } from './utils/openTheseFilesAndNotifyServer'
Expand Down Expand Up @@ -69,4 +73,26 @@ describe('textDocument/definitions', () => {
uri: 'file:///dvc.yaml'
})
})

it('should provide a single location that points to the top of the file path symbol', async () => {
const [dvcYaml] = await openTheseFilesAndNotifyServer([
{
languageId: 'yaml',
mockContents: vars_dvc_yaml,
mockPath: 'dvc.yaml'
},
{
languageId: 'json',
mockContents: '',
mockPath: 'params.json'
}
])
const 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'
})
})
})

0 comments on commit 7465318

Please sign in to comment.