Skip to content

Commit cf79a8c

Browse files
authored
fix(amazonq): utg shouldnt throw when there is no corresponding config as its not handled at callers (#1572)
* fix(amazonq): utg shouldnt throw when there is no corresponding config as its not handled at callers * test(amazonq): fix broken test cases
1 parent eee5048 commit cf79a8c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/unitTestIntentDetection.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ describe('TestIntentDetector', function () {
1414
})
1515

1616
describe('isTestFile', function () {
17-
it('should throw if language is not in the supported language set', function () {
17+
it('should return false if language is not in the supported language set', function () {
1818
const testCases = ['kotlin', 'vuejs', 'plaintext', 'markdown', 'c', 'cpp', 'foo', 'bar', 'unknown']
1919

2020
for (const testCase of testCases) {
21-
assert.throws(() => sut.isTestFile('foo', '', testCase), /lang not supported by utg completion/)
21+
assert.ok(!sut.isTestFile('foo', '', testCase))
2222
}
2323
})
2424

server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/unitTestIntentDetection.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ export class TestIntentDetector {
3939
// @VisibleForTesting
4040
isTestFile(filePath: string, fileContent: string, language: string): boolean {
4141
if (!testFileNameRegex[language]) {
42-
throw new Error('lang not supported by utg completion')
42+
// TODO: logging
43+
return false
4344
}
4445

4546
// Filename + file extension

0 commit comments

Comments
 (0)