Skip to content

Commit 490fe92

Browse files
committed
add test
1 parent eaa76bf commit 490fe92

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/amazonq/test/unit/codewhisperer/service/securityIssueTreeViewProvider.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
SeverityItem,
1313
CodeIssueGroupingStrategyState,
1414
CodeIssueGroupingStrategy,
15+
sasRuleId,
1516
} from 'aws-core-vscode/codewhisperer'
1617
import { createCodeScanIssue } from 'aws-core-vscode/test'
1718
import assert from 'assert'
@@ -153,4 +154,24 @@ describe('SecurityIssueTreeViewProvider', function () {
153154
}
154155
})
155156
})
157+
158+
describe('IssueItem', function () {
159+
it('has issueWithFix context value for issues with suggested fix', function () {
160+
const issueItem = new IssueItem(
161+
'file/path',
162+
createCodeScanIssue({ suggestedFixes: [{ code: 'fixCode', description: 'fixDescription' }] })
163+
)
164+
assert.strictEqual(issueItem.contextValue, 'issueWithFix')
165+
})
166+
167+
it('has issueWithoutFix context value for issues without suggested fix', function () {
168+
const issueItem = new IssueItem('file/path', createCodeScanIssue({ suggestedFixes: [] }))
169+
assert.strictEqual(issueItem.contextValue, 'issueWithoutFix')
170+
})
171+
172+
it('has issueWithFixDisabled context value for SAS findings', function () {
173+
const issueItem = new IssueItem('file/path', createCodeScanIssue({ ruleId: sasRuleId }))
174+
assert.strictEqual(issueItem.contextValue, 'issueWithFixDisabled')
175+
})
176+
})
156177
})

0 commit comments

Comments
 (0)