Skip to content

Commit 761bd3a

Browse files
authored
test(amazonq): patch #5994 causing CI test failing (#6019)
## Problem #5994 is causing CI test failure misuse of `sinon.alwaysReturned()` ## Solution should use `sinon.returns()` --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 932ef34 commit 761bd3a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ describe('crossFileContextUtil', function () {
4040
tempFolder = (await createTestWorkspaceFolder()).uri.fsPath
4141
})
4242

43+
afterEach(async function () {
44+
sinon.restore()
45+
})
46+
4347
it('for control group, should return opentabs context where there will be 3 chunks and each chunk should contains 50 lines', async function () {
44-
sinon.stub(FeatureConfigProvider.instance, 'getProjectContextGroup').alwaysReturned('control')
48+
sinon.stub(FeatureConfigProvider.instance, 'getProjectContextGroup').returns('control')
4549
await toTextEditor(aStringWithLineCount(200), 'CrossFile.java', tempFolder, { preview: false })
4650
const myCurrentEditor = await toTextEditor('', 'TargetFile.java', tempFolder, {
4751
preview: false,
@@ -317,7 +321,7 @@ describe('crossFileContextUtil', function () {
317321

318322
fileExtLists.forEach((fileExt) => {
319323
it('should be non empty', async function () {
320-
sinon.stub(FeatureConfigProvider.instance, 'getProjectContextGroup').alwaysReturned('control')
324+
sinon.stub(FeatureConfigProvider.instance, 'getProjectContextGroup').returns('control')
321325
const editor = await toTextEditor('content-1', `file-1.${fileExt}`, tempFolder)
322326
await toTextEditor('content-2', `file-2.${fileExt}`, tempFolder, { preview: false })
323327
await toTextEditor('content-3', `file-3.${fileExt}`, tempFolder, { preview: false })

0 commit comments

Comments
 (0)