Skip to content

Commit 1f7b44c

Browse files
committed
fix(amazonq): fix test
1 parent fd5a545 commit 1f7b44c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

server/aws-lsp-codewhisperer/src/language-server/agenticChat/context/contextCommandsProvider.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ContextCommandsProvider } from './contextCommandsProvider'
22
import * as sinon from 'sinon'
33
import { TestFeatures } from '@aws/language-server-runtimes/testing'
4+
import * as chokidar from 'chokidar'
45

56
describe('ContextCommandsProvider', () => {
67
let provider: ContextCommandsProvider
@@ -9,6 +10,10 @@ describe('ContextCommandsProvider', () => {
910
let fsReadDirStub: sinon.SinonStub
1011

1112
beforeEach(() => {
13+
sinon.stub(chokidar, 'watch').returns({
14+
on: sinon.stub(),
15+
close: sinon.stub(),
16+
} as unknown as chokidar.FSWatcher)
1217
testFeatures = new TestFeatures()
1318
fsExistsStub = sinon.stub()
1419
fsReadDirStub = sinon.stub()

server/aws-lsp-codewhisperer/src/shared/localProjectContextController.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { LocalProjectContextController } from './localProjectContextController'
2-
import { SinonStub, stub, assert as sinonAssert, match } from 'sinon'
2+
import { SinonStub, stub, assert as sinonAssert, match, restore } from 'sinon'
33
import * as assert from 'assert'
44
import * as fs from 'fs'
55
import { Dirent } from 'fs'
66
import * as path from 'path'
77
import { URI } from 'vscode-uri'
88
import { TestFeatures } from '@aws/language-server-runtimes/testing'
9+
import * as chokidar from 'chokidar'
910

1011
class LoggingMock {
1112
public error: SinonStub
@@ -40,6 +41,10 @@ describe('LocalProjectContextController', () => {
4041
name: 'workspace1',
4142
},
4243
]
44+
stub(chokidar, 'watch').returns({
45+
on: stub(),
46+
close: stub(),
47+
} as unknown as chokidar.FSWatcher)
4348

4449
vectorLibMock = {
4550
start: stub().resolves({
@@ -72,10 +77,12 @@ describe('LocalProjectContextController', () => {
7277
testFeatures.chat,
7378
testFeatures.workspace
7479
)
80+
stub(controller, 'maybeUpdateCodeSymbols').resolves()
7581
})
7682

7783
afterEach(() => {
7884
fsStub.restore()
85+
restore()
7986
})
8087

8188
describe('init', () => {

0 commit comments

Comments
 (0)