diff --git a/packages/amazonq/test/e2e/amazonq/testGen.test.ts b/packages/amazonq/test/e2e/amazonq/testGen.test.ts index 0329121a460..21db83fd6e8 100644 --- a/packages/amazonq/test/e2e/amazonq/testGen.test.ts +++ b/packages/amazonq/test/e2e/amazonq/testGen.test.ts @@ -31,19 +31,6 @@ describe('Amazon Q Test Generation', function () { }, ] - const unsupportedLanguages = [ - // move these over to testFiles once these languages are supported - // must be atleast one unsupported language here for testing - { - language: 'typescript', - filePath: 'testGenFolder/src/main/math.ts', - }, - { - language: 'javascript', - filePath: 'testGenFolder/src/main/math.js', - }, - ] - // handles opening the file since /test must be called on an active file async function setupTestDocument(filePath: string, language: string) { const document = await waitUntil(async () => { @@ -125,28 +112,6 @@ describe('Amazon Q Test Generation', function () { }) describe('/test entry', () => { - describe('Unsupported language file', () => { - const { language, filePath } = unsupportedLanguages[0] - - beforeEach(async () => { - await setupTestDocument(filePath, language) - }) - - it(`/test for unsupported language redirects to chat`, async () => { - tab.addChatMessage({ command: '/test' }) - await tab.waitForChatFinishesLoading() - - await waitForChatItems(3) - const unsupportedLanguageMessage = tab.getChatItems()[3] - - assert.deepStrictEqual(unsupportedLanguageMessage.type, 'answer') - assert.deepStrictEqual( - unsupportedLanguageMessage.body, - `I'm sorry, but /test only supports Python and Java
While ${language.charAt(0).toUpperCase() + language.slice(1)} is not supported, I will generate a suggestion below.` - ) - }) - }) - describe('External file out of project', async () => { let testFolder: TestFolder let fileName: string diff --git a/packages/core/src/amazonqTest/chat/controller/controller.ts b/packages/core/src/amazonqTest/chat/controller/controller.ts index cb5cbc2e851..07a087977d9 100644 --- a/packages/core/src/amazonqTest/chat/controller/controller.ts +++ b/packages/core/src/amazonqTest/chat/controller/controller.ts @@ -547,17 +547,12 @@ export class TestController { For Re:Invent 2024 we are supporting only java and python for unit test generation, rest of the languages shows the similar experience as CWC */ if (!['java', 'python'].includes(language) || workspaceFolder === undefined) { - let unsupportedMessage: string - const unsupportedLanguage = language ? language.charAt(0).toUpperCase() + language.slice(1) : '' if (!workspaceFolder) { // File is outside of workspace - unsupportedMessage = `I can't generate tests for ${fileName} because the file is outside of workspace scope.
I can still provide examples, instructions and code suggestions.` - } else if (unsupportedLanguage) { - unsupportedMessage = `I'm sorry, but /test only supports Python and Java
While ${unsupportedLanguage} is not supported, I will generate a suggestion below.` - } else { - unsupportedMessage = `I'm sorry, but /test only supports Python and Java
I will still generate a suggestion below.` + const unsupportedMessage = `I can't generate tests for ${fileName} because the file is outside of workspace scope.
I can still provide examples, instructions and code suggestions.` + this.messenger.sendMessage(unsupportedMessage, tabID, 'answer') } - this.messenger.sendMessage(unsupportedMessage, tabID, 'answer') + // Keeping this metric as is. TODO - Change to true once we support through other feature session.isSupportedLanguage = false await this.onCodeGeneration( session,