Skip to content

Commit 16246c6

Browse files
authored
Show account selection step for single-account AWS connections (#2057)
Fixes OPS-3842.
1 parent 6efaf64 commit 16246c6

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

packages/server/api/src/app/benchmark/providers/aws/aws-condition-resolver.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ export async function evaluateCondition(
77
context: WizardContext,
88
): Promise<boolean> {
99
switch (condition) {
10-
case 'hasMultipleAccounts':
11-
return hasMultipleAccounts(context);
10+
case 'hasAnyAccounts':
11+
return hasAnyAccounts(context);
1212
default:
1313
throwValidationError(`Unknown AWS condition method: ${condition}`);
1414
}
1515
}
1616

17-
async function hasMultipleAccounts(context: WizardContext): Promise<boolean> {
17+
async function hasAnyAccounts(context: WizardContext): Promise<boolean> {
1818
const accounts = await getConnectionAccounts(context);
19-
return accounts.length > 1;
19+
return accounts.length >= 1;
2020
}

packages/server/api/src/app/benchmark/providers/aws/aws.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"title": "Which accounts should we include in the report?",
1515
"selectionType": "multi-select",
1616
"conditional": {
17-
"when": "hasMultipleAccounts",
17+
"when": "hasAnyAccounts",
1818
"onSuccess": {
1919
"optionsSource": {
2020
"type": "dynamic",

packages/server/api/test/unit/benchmark/providers/aws/aws-condition-resolver.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('evaluateCondition', () => {
3131
]);
3232

3333
const result = await evaluateCondition(
34-
'hasMultipleAccounts',
34+
'hasAnyAccounts',
3535
contextWithConnection,
3636
);
3737

@@ -41,24 +41,24 @@ describe('evaluateCondition', () => {
4141
expect(result).toBe(true);
4242
});
4343

44-
it('returns false when connection has one account', async () => {
44+
it('returns true when connection has exactly one account', async () => {
4545
mockGetConnectionAccounts.mockResolvedValue([
4646
{ id: '111111111111', displayName: 'Only' },
4747
]);
4848

4949
const result = await evaluateCondition(
50-
'hasMultipleAccounts',
50+
'hasAnyAccounts',
5151
contextWithConnection,
5252
);
5353

54-
expect(result).toBe(false);
54+
expect(result).toBe(true);
5555
});
5656

5757
it('returns false when connection has zero accounts', async () => {
5858
mockGetConnectionAccounts.mockResolvedValue([]);
5959

6060
const result = await evaluateCondition(
61-
'hasMultipleAccounts',
61+
'hasAnyAccounts',
6262
contextWithConnection,
6363
);
6464

0 commit comments

Comments
 (0)