Skip to content

Commit

Permalink
test(amazonq): patch #5994 causing CI test failing (#6019)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
Will-ShaoHua authored Nov 14, 2024
1 parent 932ef34 commit 761bd3a
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ describe('crossFileContextUtil', function () {
tempFolder = (await createTestWorkspaceFolder()).uri.fsPath
})

afterEach(async function () {
sinon.restore()
})

it('for control group, should return opentabs context where there will be 3 chunks and each chunk should contains 50 lines', async function () {
sinon.stub(FeatureConfigProvider.instance, 'getProjectContextGroup').alwaysReturned('control')
sinon.stub(FeatureConfigProvider.instance, 'getProjectContextGroup').returns('control')
await toTextEditor(aStringWithLineCount(200), 'CrossFile.java', tempFolder, { preview: false })
const myCurrentEditor = await toTextEditor('', 'TargetFile.java', tempFolder, {
preview: false,
Expand Down Expand Up @@ -317,7 +321,7 @@ describe('crossFileContextUtil', function () {

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

0 comments on commit 761bd3a

Please sign in to comment.