test: make LSP canonical fixture cross-platform
This commit is contained in:
@@ -130,23 +130,24 @@ describe('tool-lsp execution', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('keeps all acquired locations in the canonical value when presentation is capped', async () => {
|
it('keeps all acquired locations in the canonical value when presentation is capped', async () => {
|
||||||
|
const cappedWorkspaceRoot = resolve('/virtual/capped-workspace')
|
||||||
const locations = [
|
const locations = [
|
||||||
{ uri: 'file:///ws/a.ts', range: { start: { line: 0, character: 0 }, end: { line: 0, character: 1 } } },
|
{ uri: pathToFileURL(join(cappedWorkspaceRoot, 'a.ts')).href, range: { start: { line: 0, character: 0 }, end: { line: 0, character: 1 } } },
|
||||||
{ uri: 'file:///ws/b.ts', range: { start: { line: 1, character: 2 }, end: { line: 1, character: 3 } } },
|
{ uri: pathToFileURL(join(cappedWorkspaceRoot, 'b.ts')).href, range: { start: { line: 1, character: 2 }, end: { line: 1, character: 3 } } },
|
||||||
]
|
]
|
||||||
const { ctx } = await mount(stubProvider(() => ({
|
const { ctx } = await mount(stubProvider(() => ({
|
||||||
kind: 'locations',
|
kind: 'locations',
|
||||||
locations,
|
locations,
|
||||||
resolvedWorkspaceRoot: '/ws',
|
resolvedWorkspaceRoot: cappedWorkspaceRoot,
|
||||||
})), { maxLocations: 1 })
|
})), { maxLocations: 1 })
|
||||||
const result = await call(ctx, { operation: 'findReferences', file_path: 'a.ts', line: 1, character: 1 }, '/ws')
|
const result = await call(ctx, { operation: 'findReferences', file_path: 'a.ts', line: 1, character: 1 }, cappedWorkspaceRoot)
|
||||||
expect(result.content[0]).toEqual({
|
expect(result.content[0]).toEqual({
|
||||||
type: 'text',
|
type: 'text',
|
||||||
text: 'a.ts:1:1\n… 1 more location omitted (limit 1).',
|
text: 'a.ts:1:1\n… 1 more location omitted (limit 1).',
|
||||||
})
|
})
|
||||||
expect(result).toMatchObject({
|
expect(result).toMatchObject({
|
||||||
isError: false,
|
isError: false,
|
||||||
value: { kind: 'locations', locations, resolvedWorkspaceRoot: '/ws' },
|
value: { kind: 'locations', locations, resolvedWorkspaceRoot: cappedWorkspaceRoot },
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user