Skip to content

Commit d17ed77

Browse files
committed
fix test failure
1 parent 4c2bbda commit d17ed77

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

packages/amazonq/test/unit/codewhisperer/util/crossFileContextUtil.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,16 @@ describe('crossFileContextUtil', function () {
330330
fileExtLists.forEach((fileExt) => {
331331
it('should be non empty', async function () {
332332
sinon.stub(FeatureConfigProvider.instance, 'getProjectContextGroup').returns('control')
333+
sinon
334+
.stub(LspController.instance, 'queryInlineProjectContext')
335+
.withArgs(sinon.match.any, sinon.match.any, 'codemap')
336+
.resolves([
337+
{
338+
content: 'foo',
339+
score: 0,
340+
filePath: 'q-inline',
341+
},
342+
])
333343
const editor = await toTextEditor('content-1', `file-1.${fileExt}`, tempFolder)
334344
await toTextEditor('content-2', `file-2.${fileExt}`, tempFolder, { preview: false })
335345
await toTextEditor('content-3', `file-3.${fileExt}`, tempFolder, { preview: false })

packages/amazonq/test/unit/codewhisperer/util/supplemetalContextUtil.test.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as crossFile from 'aws-core-vscode/codewhisperer'
1010
import { TestFolder, assertTabCount } from 'aws-core-vscode/test'
1111
import { FeatureConfigProvider } from 'aws-core-vscode/codewhisperer'
1212
import { toTextEditor } from 'aws-core-vscode/test'
13+
import { LspController } from 'aws-core-vscode/amazonq'
1314

1415
describe('supplementalContextUtil', function () {
1516
let testFolder: TestFolder
@@ -31,6 +32,16 @@ describe('supplementalContextUtil', function () {
3132
describe('fetchSupplementalContext', function () {
3233
describe('openTabsContext', function () {
3334
it('opentabContext should include chunks if non empty', async function () {
35+
sinon
36+
.stub(LspController.instance, 'queryInlineProjectContext')
37+
.withArgs(sinon.match.any, sinon.match.any, 'codemap')
38+
.resolves([
39+
{
40+
content: 'foo',
41+
score: 0,
42+
filePath: 'q-inline',
43+
},
44+
])
3445
await toTextEditor('class Foo', 'Foo.java', testFolder.path, { preview: false })
3546
await toTextEditor('class Bar', 'Bar.java', testFolder.path, { preview: false })
3647
await toTextEditor('class Baz', 'Baz.java', testFolder.path, { preview: false })
@@ -42,7 +53,7 @@ describe('supplementalContextUtil', function () {
4253
await assertTabCount(4)
4354

4455
const actual = await crossFile.fetchSupplementalContext(editor, fakeCancellationToken)
45-
assert.ok(actual?.supplementalContextItems.length === 3)
56+
assert.ok(actual?.supplementalContextItems.length === 4)
4657
})
4758

4859
it('opentabsContext should filter out empty chunks', async function () {

0 commit comments

Comments
 (0)