Skip to content

Commit

Permalink
Test: Check that completions are provided for overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
deribaucourt committed Nov 2, 2023
1 parent 102c252 commit 08ba592
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions server/src/__tests__/completions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { analyzer } from '../tree-sitter/analyzer'
import { FIXTURE_DOCUMENT } from './fixtures/fixtures'
import { generateParser } from '../tree-sitter/parser'
import { bitBakeDocScanner } from '../BitBakeDocScanner'
import bitBakeProjectScanner from '../BitBakeProjectScanner'

const DUMMY_URI = 'dummy_uri'

Expand Down Expand Up @@ -118,7 +119,7 @@ describe('On Completion', () => {
expect(result).not.toEqual([])
})

it('provides suggestions for overrides when a ":" is typed and it follows an identifier', async () => {
it('provides suggestions for operators when a ":" is typed and it follows an identifier', async () => {
await analyzer.analyze({
uri: DUMMY_URI,
document: FIXTURE_DOCUMENT.COMPLETION
Expand All @@ -140,7 +141,38 @@ describe('On Completion', () => {
label: 'append',
kind: 24
}
// TODO: add an override item
])
)
})

it('provides suggestions for overrides when a ":" is typed and it follows an identifier', async () => {
await analyzer.analyze({
uri: DUMMY_URI,
document: FIXTURE_DOCUMENT.COMPLETION
})

const spy = jest.spyOn(bitBakeProjectScanner, 'overrides', 'get').mockReturnValue(['class-target'])

const result = onCompletionHandler({
textDocument: {
uri: DUMMY_URI
},
position: {
line: 2,
character: 6
}
})

spy.mockRestore()

expect(result).toEqual(
expect.arrayContaining([
expect.objectContaining(
{
label: 'class-target',
kind: 10
}
)
])
)
})
Expand Down

0 comments on commit 08ba592

Please sign in to comment.