Skip to content

Commit

Permalink
An additional argument provider unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Yu committed Sep 29, 2024
1 parent fa03aee commit d8772c5
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions test/units/13_completion_latex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import assert from 'assert'

describe.only(path.basename(__filename).split('.')[0] + ':', () => {
let document: TextDocument
let getIncludedTeXStub: sinon.SinonStub
let citationSpy: sinon.SinonSpy
let referenceSpy: sinon.SinonSpy
let environmentSpy: sinon.SinonSpy
Expand All @@ -34,11 +33,10 @@ describe.only(path.basename(__filename).split('.')[0] + ':', () => {
let closeenvSpy: sinon.SinonSpy

before(() => {
mock.init(lw, 'root', 'completion')
mock.init(lw, 'root', 'cache', 'completion')
mock.activeTextEditor(get.path('main.tex'), '', {
languageId: 'latex',
})
getIncludedTeXStub = lw.cache.getIncludedTeX as sinon.SinonStub
document = vscode.window.activeTextEditor?.document as TextDocument
citationSpy = sinon.spy(citationProvider, 'from')
referenceSpy = sinon.spy(referenceProvider, 'from')
Expand All @@ -55,14 +53,6 @@ describe.only(path.basename(__filename).split('.')[0] + ':', () => {
closeenvSpy = sinon.spy(closeenvProvider, 'from')
})

beforeEach(() => {
getIncludedTeXStub.returns([])
})

afterEach(() => {
getIncludedTeXStub.reset()
})

after(() => {
sinon.restore()
})
Expand Down Expand Up @@ -195,6 +185,12 @@ describe.only(path.basename(__filename).split('.')[0] + ':', () => {
}
})

it('should remove all existing completed arguments before passing to argument provider', () => {
argumentSpy.resetHistory()
provide('\\command[arg]{arg}{')
assert.strictEqual(argumentSpy.getCall(0)?.args[0]?.[0], '\\command{')
})

it('should invoke package provider', () => {
const lines = [
'\\usepackage{',
Expand Down

0 comments on commit d8772c5

Please sign in to comment.