Skip to content

Commit

Permalink
incorporate review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mazyu36 committed Jul 29, 2024
1 parent df19851 commit bb82a5e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ export class GeofenceCollection extends GeofenceCollectionBase {

constructor(scope: Construct, id: string, props: GeofenceCollectionProps = {}) {

if (props.description !== undefined && !Token.isUnresolved(props.description) && props.description.length < 0 && props.description.length > 1000) {
throw new Error(`\`description\` must be between 0 and 1000 characters. Received: ${props.description.length} characters` );
if (props.description !== undefined && !Token.isUnresolved(props.description) && props.description.length > 1000) {
throw new Error(`\`description\` must be between 0 and 1000 characters. Received: ${props.description.length} characters`);
}

if (props.geofenceCollectionName && !Token.isUnresolved(props.geofenceCollectionName) && !/^[-.\w]{1,100}$/.test(props.geofenceCollectionName)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ beforeEach(() => {
stack = new Stack();
});

test('create a geofence collecction', () => {
test('create a geofence collection', () => {
new GeofenceCollection(stack, 'GeofenceCollection', { description: 'test' });

Template.fromStack(stack).hasResourceProperties('AWS::Location::GeofenceCollection', {
Expand All @@ -18,6 +18,14 @@ test('create a geofence collecction', () => {
});
});

test('creates geofence collection with empty description', () => {
new GeofenceCollection(stack, 'GeofenceCollection', { description: '' });

Template.fromStack(stack).hasResourceProperties('AWS::Location::GeofenceCollection', {
Description: '',
});
});

test('throws with invalid description', () => {
expect(() => new GeofenceCollection(stack, 'GeofenceCollection', {
description: 'a'.repeat(1001),
Expand Down

0 comments on commit bb82a5e

Please sign in to comment.