Skip to content

Commit 9bb3be3

Browse files
committed
fix(core): fixing Fix icon failed unit test
1 parent c9a3e9e commit 9bb3be3

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

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

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,41 @@ describe('securityIssueHoverProvider', () => {
2121
token = new vscode.CancellationTokenSource()
2222
})
2323

24-
function buildCommandLink(command: string, args: any[], label: string, tooltip: string): string {
25-
return `[$(${command.includes('ignore') ? 'error' : 'comment'}) ${label}](command:${command}?${encodeURIComponent(JSON.stringify(args))} '${tooltip}')`
24+
function buildCommandLink(
25+
command: string,
26+
commandIcon: string,
27+
args: any[],
28+
label: string,
29+
tooltip: string
30+
): string {
31+
return `[$(${commandIcon}) ${label}](command:${command}?${encodeURIComponent(JSON.stringify(args))} '${tooltip}')`
2632
}
2733

2834
function buildExpectedContent(issue: any, fileName: string, description: string, severity?: string): string {
2935
const severityBadge = severity ? ` ![${severity}](severity-${severity.toLowerCase()}.svg)` : ' '
3036
const commands = [
31-
buildCommandLink('aws.amazonq.explainIssue', [issue, fileName], 'Explain', 'Explain with Amazon Q'),
32-
buildCommandLink('aws.amazonq.generateFix', [issue, fileName], 'Fix', 'Fix with Amazon Q'),
33-
buildCommandLink('aws.amazonq.security.ignore', [issue, fileName, 'hover'], 'Ignore', 'Ignore Issue'),
34-
buildCommandLink('aws.amazonq.security.ignoreAll', [issue, 'hover'], 'Ignore All', 'Ignore Similar Issues'),
37+
buildCommandLink(
38+
'aws.amazonq.explainIssue',
39+
'comment',
40+
[issue, fileName],
41+
'Explain',
42+
'Explain with Amazon Q'
43+
),
44+
buildCommandLink('aws.amazonq.generateFix', 'wrench', [issue, fileName], 'Fix', 'Fix with Amazon Q'),
45+
buildCommandLink(
46+
'aws.amazonq.security.ignore',
47+
'error',
48+
[issue, fileName, 'hover'],
49+
'Ignore',
50+
'Ignore Issue'
51+
),
52+
buildCommandLink(
53+
'aws.amazonq.security.ignoreAll',
54+
'error',
55+
[issue, 'hover'],
56+
'Ignore All',
57+
'Ignore Similar Issues'
58+
),
3559
]
3660
return `## title${severityBadge}\n${description}\n\n${commands.join('\n | ')}\n`
3761
}

0 commit comments

Comments
 (0)