Skip to content

Commit eaa1a99

Browse files
Merge staging into feature/q-region-expansion
2 parents 20089a2 + b1bdc35 commit eaa1a99

File tree

2 files changed

+3
-43
lines changed

2 files changed

+3
-43
lines changed

packages/amazonq/test/e2e/amazonq/testGen.test.ts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,6 @@ describe('Amazon Q Test Generation', function () {
3131
},
3232
]
3333

34-
const unsupportedLanguages = [
35-
// move these over to testFiles once these languages are supported
36-
// must be atleast one unsupported language here for testing
37-
{
38-
language: 'typescript',
39-
filePath: 'testGenFolder/src/main/math.ts',
40-
},
41-
{
42-
language: 'javascript',
43-
filePath: 'testGenFolder/src/main/math.js',
44-
},
45-
]
46-
4734
// handles opening the file since /test must be called on an active file
4835
async function setupTestDocument(filePath: string, language: string) {
4936
const document = await waitUntil(async () => {
@@ -125,28 +112,6 @@ describe('Amazon Q Test Generation', function () {
125112
})
126113

127114
describe('/test entry', () => {
128-
describe('Unsupported language file', () => {
129-
const { language, filePath } = unsupportedLanguages[0]
130-
131-
beforeEach(async () => {
132-
await setupTestDocument(filePath, language)
133-
})
134-
135-
it(`/test for unsupported language redirects to chat`, async () => {
136-
tab.addChatMessage({ command: '/test' })
137-
await tab.waitForChatFinishesLoading()
138-
139-
await waitForChatItems(3)
140-
const unsupportedLanguageMessage = tab.getChatItems()[3]
141-
142-
assert.deepStrictEqual(unsupportedLanguageMessage.type, 'answer')
143-
assert.deepStrictEqual(
144-
unsupportedLanguageMessage.body,
145-
`<span style="color: #EE9D28;">&#9888;<b>I'm sorry, but /test only supports Python and Java</b><br></span> While ${language.charAt(0).toUpperCase() + language.slice(1)} is not supported, I will generate a suggestion below.`
146-
)
147-
})
148-
})
149-
150115
describe('External file out of project', async () => {
151116
let testFolder: TestFolder
152117
let fileName: string

packages/core/src/amazonqTest/chat/controller/controller.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -551,17 +551,12 @@ export class TestController {
551551
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
552552
*/
553553
if (!['java', 'python'].includes(language) || workspaceFolder === undefined) {
554-
let unsupportedMessage: string
555-
const unsupportedLanguage = language ? language.charAt(0).toUpperCase() + language.slice(1) : ''
556554
if (!workspaceFolder) {
557555
// File is outside of workspace
558-
unsupportedMessage = `<span style="color: #EE9D28;">&#9888;<b>I can't generate tests for ${fileName}</b> because the file is outside of workspace scope.<br></span> I can still provide examples, instructions and code suggestions.`
559-
} else if (unsupportedLanguage) {
560-
unsupportedMessage = `<span style="color: #EE9D28;">&#9888;<b>I'm sorry, but /test only supports Python and Java</b><br></span> While ${unsupportedLanguage} is not supported, I will generate a suggestion below.`
561-
} else {
562-
unsupportedMessage = `<span style="color: #EE9D28;">&#9888;<b>I'm sorry, but /test only supports Python and Java</b><br></span> I will still generate a suggestion below.`
556+
const unsupportedMessage = `<span style="color: #EE9D28;">&#9888;<b>I can't generate tests for ${fileName}</b> because the file is outside of workspace scope.<br></span> I can still provide examples, instructions and code suggestions.`
557+
this.messenger.sendMessage(unsupportedMessage, tabID, 'answer')
563558
}
564-
this.messenger.sendMessage(unsupportedMessage, tabID, 'answer')
559+
// Keeping this metric as is. TODO - Change to true once we support through other feature
565560
session.isSupportedLanguage = false
566561
await this.onCodeGeneration(
567562
session,

0 commit comments

Comments
 (0)