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
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
})
}

Expand Down
Loading