diff --git a/apps/studio/components/layouts/AppLayout/StatusPageBanner.utils.test.ts b/apps/studio/components/layouts/AppLayout/StatusPageBanner.utils.test.ts index 4c7e687c97b3a..2c18ae97b51fa 100644 --- a/apps/studio/components/layouts/AppLayout/StatusPageBanner.utils.test.ts +++ b/apps/studio/components/layouts/AppLayout/StatusPageBanner.utils.test.ts @@ -145,6 +145,21 @@ describe('shouldShowBanner', () => { ).toBe(true) }) + it('shows when affected region has inconsistent casing (AI-generated cache)', () => { + expect( + shouldShowBanner({ + incidents: [ + { + id: 'test', + cache: { affected_regions: ['US-East-1'], affects_project_creation: false }, + }, + ], + hasProjects: true, + userRegions: new Set(['us-east-1']), + }) + ).toBe(true) + }) + it('does not show when user has no databases in any affected region', () => { expect( shouldShowBanner({ @@ -280,6 +295,21 @@ describe('getRelevantIncidentIds', () => { ).toEqual(expect.arrayContaining(['ap-southeast-1-only', 'eu-west-1-only'])) }) + it('returns the ID of a relevant incident when affected_regions has inconsistent casing', () => { + expect( + getRelevantIncidentIds({ + incidents: [ + { + id: 'mixed-case-region', + cache: { affected_regions: ['US-East-1'], affects_project_creation: false }, + }, + ], + hasProjects: true, + userRegions: new Set(['us-east-1']), + }) + ).toEqual(['mixed-case-region']) + }) + it('excludes incidents irrelevant to the user from the result', () => { // User is in eu-west-1; us-east-1-only incident should not be included expect( diff --git a/apps/studio/components/layouts/AppLayout/StatusPageBanner.utils.ts b/apps/studio/components/layouts/AppLayout/StatusPageBanner.utils.ts index b1423bfcc4e47..ce9698d807f4d 100644 --- a/apps/studio/components/layouts/AppLayout/StatusPageBanner.utils.ts +++ b/apps/studio/components/layouts/AppLayout/StatusPageBanner.utils.ts @@ -40,7 +40,7 @@ export function shouldShowBanner({ if (hasUnknownRegions) return true // Region restriction: only show if the user has a database in an affected region - return affectedRegions.some((region) => userRegions.has(region)) + return affectedRegions.some((region) => userRegions.has(region.toLowerCase())) }) }