Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 7 additions & 7 deletions frontend/src/__tests__/approval-details.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ describe('renderApprovalDetailsBody', () => {
it('shows "CUDly host (id)" for AWS recs without cloud_account_id when host account is known', () => {
const rec = makeRec({ provider: 'aws' });
delete rec.cloud_account_id;
const body = renderApprovalDetailsBody(makeDetails([rec]), new Map(), '909626172446');
const body = renderApprovalDetailsBody(makeDetails([rec]), new Map(), '444444444444');
const cells = body.querySelectorAll('.approval-details-table tbody td');
expect(cells[0]?.textContent).toBe('CUDly host (909626172446)');
expect(cells[0]?.textContent).toBe('CUDly host (444444444444)');
});

it('shows "Account deleted" warning for Azure recs without cloud_account_id', () => {
const rec = makeRec({ provider: 'azure' });
delete rec.cloud_account_id;
const body = renderApprovalDetailsBody(makeDetails([rec]), new Map(), '909626172446');
const body = renderApprovalDetailsBody(makeDetails([rec]), new Map(), '444444444444');
const cells = body.querySelectorAll('.approval-details-table tbody td');
expect(cells[0]?.textContent).toBe('⚠ Account deleted — purchase cannot execute');
});
Expand Down Expand Up @@ -238,7 +238,7 @@ describe('renderApprovalDetailsBody', () => {
it('counts "Accounts: 1" for an all-host-account purchase (host AWS account, no cloud_account_id)', () => {
const rec = makeRec({ provider: 'aws' });
delete rec.cloud_account_id;
const body = renderApprovalDetailsBody(makeDetails([rec]), new Map(), '909626172446');
const body = renderApprovalDetailsBody(makeDetails([rec]), new Map(), '444444444444');
const stats = body.querySelectorAll('.approval-details-stat');
// Stat index 7 = Accounts.
expect(stats[7]?.querySelector('.approval-details-stat-value')?.textContent).toBe('1');
Expand All @@ -248,15 +248,15 @@ describe('renderApprovalDetailsBody', () => {
const hostRec = makeRec({ id: 'r1', provider: 'aws' });
delete hostRec.cloud_account_id;
const namedRec = makeRec({ id: 'r2', provider: 'aws', cloud_account_id: 'acct-uuid-1' });
const body = renderApprovalDetailsBody(makeDetails([hostRec, namedRec]), new Map(), '909626172446');
const body = renderApprovalDetailsBody(makeDetails([hostRec, namedRec]), new Map(), '444444444444');
const stats = body.querySelectorAll('.approval-details-stat');
expect(stats[7]?.querySelector('.approval-details-stat-value')?.textContent).toBe('2');
});

it('does NOT count an orphan row (cloud_account_id nil AND provider !== aws) in the Accounts total', () => {
const orphanRec = makeRec({ provider: 'azure' });
delete orphanRec.cloud_account_id;
const body = renderApprovalDetailsBody(makeDetails([orphanRec]), new Map(), '909626172446');
const body = renderApprovalDetailsBody(makeDetails([orphanRec]), new Map(), '444444444444');
const stats = body.querySelectorAll('.approval-details-stat');
expect(stats[7]?.querySelector('.approval-details-stat-value')?.textContent).toBe('0');
});
Expand Down Expand Up @@ -290,7 +290,7 @@ describe('formatAccountLabel', () => {

// issue #608: distinguish genuine ambient from deleted account
it('returns "CUDly host (id)" when provider is aws, no recAccountId, and hostAWSAccountID is known', () => {
expect(formatAccountLabel(undefined, undefined, 'aws', '909626172446')).toBe('CUDly host (909626172446)');
expect(formatAccountLabel(undefined, undefined, 'aws', '444444444444')).toBe('CUDly host (444444444444)');
});

it('returns "Account deleted" warning for azure with no recAccountId', () => {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/__tests__/settings-accounts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ describe('Account overrides modal', () => {
test('switching accounts swaps the modal title; only one account context is active at a time', async () => {
(api.listAccounts as jest.Mock).mockResolvedValue([
{ id: 'acc-a', name: 'AWS Prod', provider: 'aws', external_id: '123456789012', enabled: true },
{ id: 'acc-b', name: 'CUDly host', provider: 'aws', external_id: '909626172446', enabled: true },
{ id: 'acc-b', name: 'CUDly host', provider: 'aws', external_id: '444444444444', enabled: true },
]);
(api.listAccountServiceOverrides as jest.Mock).mockResolvedValue([]);

Expand All @@ -1297,7 +1297,7 @@ describe('Account overrides modal', () => {

// Click Overrides on Account B without closing the modal first.
(document.querySelector(
`button[aria-label="Service overrides for CUDly host (909626172446)"]`,
`button[aria-label="Service overrides for CUDly host (444444444444)"]`,
) as HTMLButtonElement).click();
await new Promise(r => setTimeout(r, 0));

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ require (
go.opentelemetry.io/otel/metric v1.45.0 // indirect
go.opentelemetry.io/otel/trace v1.45.0 // indirect
golang.org/x/crypto v0.58.0
golang.org/x/net v0.61.0 // indirect
golang.org/x/net v0.62.0 // indirect
golang.org/x/oauth2 v0.37.0
golang.org/x/sync v0.24.0
golang.org/x/sys v0.49.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54=
golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w=
golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg=
golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs=
golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw=
golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY=
golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98=
golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58=
golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA=
Expand Down
Loading