Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions packages/core/src/amazonqTest/chat/controller/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,8 @@ 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 user request test generation from input chat without opening a file, its difficult to get the language, so default will be plainText
*/
if (language !== 'java' && language !== 'python' && language !== 'plaintext') {
if (language !== 'java' && language !== 'python') {
const unsupportedLanguage = language.charAt(0).toUpperCase() + language.slice(1)
let 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. `
// handle the case when language is undefined
Expand Down Expand Up @@ -640,7 +639,6 @@ export class TestController {
const session = this.sessionStorage.getSession()
session.acceptedJobId = session.listOfTestGenerationJobId[session.listOfTestGenerationJobId.length - 1]
const filePath = session.generatedFilePath
session.fileLanguage = await this.getLanguageForFilePath(filePath)
const absolutePath = path.join(session.projectRootPath, filePath)
const fileExists = await fs.existsFile(absolutePath)
const buildCommand = session.updatedBuildCommands?.join(' ')
Expand Down Expand Up @@ -724,7 +722,7 @@ export class TestController {
acceptedCharactersCount: session.charsOfCodeAccepted,
generatedLinesCount: session.linesOfCodeGenerated,
acceptedLinesCount: session.linesOfCodeAccepted,
cwsprChatProgrammingLanguage: session.fileLanguage,
cwsprChatProgrammingLanguage: session.fileLanguage ?? 'plaintext',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the proper place to put this default? Will other functions also default to plaintext? If so, initialize in a common place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chungjac is working on this.
We aim to declare the telemetry function in telemetryHelper.ts and use it here but for now fixing this here.

jobId: session.listOfTestGenerationJobId[0], // For RIV, UTG does only one StartTestGeneration API call so jobId = session.listOfTestGenerationJobId[0]
jobGroup: session.testGenerationJobGroupName,
buildPayloadBytes: session.srcPayloadSize,
Expand Down
Loading