Skip to content

Commit

Permalink
add feedback from Momo
Browse files Browse the repository at this point in the history
  • Loading branch information
msambol committed Oct 24, 2023
1 parent a127b92 commit 17654c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/aws-cdk-lib/region-info/lib/fact.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { AWS_REGIONS } from './aws-entities';

/**
* A database of regional information.
*/
export class Fact {
/**
* @returns the list of names of AWS regions for which there is at least one registered fact. This
* may not be an exhaustive list of all available AWS regions.
* includes Regions defined in AWS_REGIONS plus custom defined regions.
*/
public static get regions(): string[] {
// Return by copy to ensure no modifications can be made to the undelying constant.
return Array.from(Object.keys(this.database));
return Array.from(AWS_REGIONS.concat(Object.keys(this.database)));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk-lib/region-info/test/fact.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('register', () => {

test('registering a fact with a new region adds the region', () => {
// GIVEN
const region = 'us-unreleased-1';
const region = 'my-custom-region';
const name = FactName.PARTITION;
const value = 'nebraska';

Expand All @@ -101,7 +101,7 @@ describe('register', () => {
expect(() => Fact.register({ region, name, value })).not.toThrowError();

// THEN
expect(Fact.regions.includes('us-unreleased-1')).toBeTruthy();
expect(Fact.regions.includes('my-custom-region')).toBeTruthy();
expect(Fact.find(region, name)).toBe('nebraska');
});
});

0 comments on commit 17654c3

Please sign in to comment.