diff --git a/packages/amazonq/test/unit/codewhisperer/util/crossFileContextUtil.test.ts b/packages/amazonq/test/unit/codewhisperer/util/crossFileContextUtil.test.ts index a3cfbbe35e7..372aa566396 100644 --- a/packages/amazonq/test/unit/codewhisperer/util/crossFileContextUtil.test.ts +++ b/packages/amazonq/test/unit/codewhisperer/util/crossFileContextUtil.test.ts @@ -50,10 +50,12 @@ describe('crossFileContextUtil', function () { const myCurrentEditor = await toTextEditor('', 'TargetFile.java', tempFolder, { preview: false, }) + + await assertTabCount(2) + const actual = await crossFile.fetchSupplementalContextForSrc(myCurrentEditor, fakeCancellationToken) assert.ok(actual) - assert.ok(actual.supplementalContextItems.length === 3) - + assert.strictEqual(actual.supplementalContextItems.length, 3) assert.strictEqual(actual.supplementalContextItems[0].content.split('\n').length, 50) assert.strictEqual(actual.supplementalContextItems[1].content.split('\n').length, 50) assert.strictEqual(actual.supplementalContextItems[2].content.split('\n').length, 50) @@ -64,6 +66,9 @@ describe('crossFileContextUtil', function () { const myCurrentEditor = await toTextEditor('', 'TargetFile.java', tempFolder, { preview: false, }) + + await assertTabCount(2) + sinon.stub(FeatureConfigProvider.instance, 'getProjectContextGroup').returns('t1') sinon .stub(LspController.instance, 'queryInlineProjectContext') @@ -78,7 +83,7 @@ describe('crossFileContextUtil', function () { const actual = await crossFile.fetchSupplementalContextForSrc(myCurrentEditor, fakeCancellationToken) assert.ok(actual) - assert.ok(actual.supplementalContextItems.length === 4) + assert.strictEqual(actual.supplementalContextItems.length, 4) assert.strictEqual(actual?.strategy, 'codemap') assert.deepEqual(actual?.supplementalContextItems[0], { content: 'foo', @@ -96,6 +101,9 @@ describe('crossFileContextUtil', function () { const myCurrentEditor = await toTextEditor('', 'TargetFile.java', tempFolder, { preview: false, }) + + await assertTabCount(2) + sinon.stub(FeatureConfigProvider.instance, 'getProjectContextGroup').returns('t2') sinon .stub(LspController.instance, 'queryInlineProjectContext') @@ -130,7 +138,7 @@ describe('crossFileContextUtil', function () { const actual = await crossFile.fetchSupplementalContextForSrc(myCurrentEditor, fakeCancellationToken) assert.ok(actual) - assert.ok(actual.supplementalContextItems.length === 5) + assert.strictEqual(actual.supplementalContextItems.length, 5) assert.strictEqual(actual?.strategy, 'bm25') assert.deepEqual(actual?.supplementalContextItems[0], { diff --git a/packages/amazonq/test/unit/codewhisperer/util/supplemetalContextUtil.test.ts b/packages/amazonq/test/unit/codewhisperer/util/supplemetalContextUtil.test.ts index 9e45180a758..25f3ce1a585 100644 --- a/packages/amazonq/test/unit/codewhisperer/util/supplemetalContextUtil.test.ts +++ b/packages/amazonq/test/unit/codewhisperer/util/supplemetalContextUtil.test.ts @@ -7,7 +7,7 @@ import assert from 'assert' import * as vscode from 'vscode' import * as sinon from 'sinon' import * as crossFile from 'aws-core-vscode/codewhisperer' -import { TestFolder } from 'aws-core-vscode/test' +import { TestFolder, assertTabCount } from 'aws-core-vscode/test' import { FeatureConfigProvider } from 'aws-core-vscode/codewhisperer' import { toTextEditor } from 'aws-core-vscode/test' @@ -39,6 +39,8 @@ describe('supplementalContextUtil', function () { preview: false, }) + await assertTabCount(4) + const actual = await crossFile.fetchSupplementalContext(editor, fakeCancellationToken) assert.ok(actual?.supplementalContextItems.length === 3) }) @@ -53,6 +55,8 @@ describe('supplementalContextUtil', function () { preview: false, }) + await assertTabCount(4) + const actual = await crossFile.fetchSupplementalContext(editor, fakeCancellationToken) assert.ok(actual?.supplementalContextItems.length === 0) })