Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unreliable test: (crossFileContextUtil) (fetchSupplementalContextForSrc) for t1 group, should return repomap + opentabs context #6041

Closed
Hweinstock opened this issue Nov 18, 2024 · 1 comment

Comments

@Hweinstock
Copy link
Contributor

Failure on Mac Insider: https://github.com/aws/aws-toolkit-vscode/actions/runs/11898730807/job/33155856715

log snippet:

  1) crossFileContextUtil
       fetchSupplementalContextForSrc
         for t1 group, should return repomap + opentabs context:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 4

      + expected - actual

      -0
      +4
      
      at Context.<anonymous> (test/unit/codewhisperer/util/crossFileContextUtil.test.ts:86:20)

test:

it('for t1 group, should return repomap + opentabs context', async function () {
await toTextEditor(aStringWithLineCount(200), 'CrossFile.java', tempFolder, { preview: false })
const myCurrentEditor = await toTextEditor('', 'TargetFile.java', tempFolder, {
preview: false,
})
await assertTabCount(2)
sinon.stub(FeatureConfigProvider.instance, 'getProjectContextGroup').returns('t1')
sinon
.stub(LspController.instance, 'queryInlineProjectContext')
.withArgs(sinon.match.any, sinon.match.any, 'codemap')
.resolves([
{
content: 'foo',
score: 0,
filePath: 'q-inline',
},
])
const actual = await crossFile.fetchSupplementalContextForSrc(myCurrentEditor, fakeCancellationToken)
assert.ok(actual)
assert.strictEqual(actual.supplementalContextItems.length, 4)
assert.strictEqual(actual?.strategy, 'codemap')
assert.deepEqual(actual?.supplementalContextItems[0], {
content: 'foo',
score: 0,
filePath: 'q-inline',
})
assert.strictEqual(actual.supplementalContextItems[1].content.split('\n').length, 50)
assert.strictEqual(actual.supplementalContextItems[2].content.split('\n').length, 50)
assert.strictEqual(actual.supplementalContextItems[3].content.split('\n').length, 50)
})

@Hweinstock
Copy link
Contributor Author

Duplicate of #6079

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant