diff --git a/packages/@aws-cdk/aws-location-alpha/lib/geofence-collection.ts b/packages/@aws-cdk/aws-location-alpha/lib/geofence-collection.ts index e199e5b841baf..10931a6389485 100644 --- a/packages/@aws-cdk/aws-location-alpha/lib/geofence-collection.ts +++ b/packages/@aws-cdk/aws-location-alpha/lib/geofence-collection.ts @@ -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)) { diff --git a/packages/@aws-cdk/aws-location-alpha/test/geofence-collection.test.ts b/packages/@aws-cdk/aws-location-alpha/test/geofence-collection.test.ts index ba3ac13072206..5ff30c63a940b 100644 --- a/packages/@aws-cdk/aws-location-alpha/test/geofence-collection.test.ts +++ b/packages/@aws-cdk/aws-location-alpha/test/geofence-collection.test.ts @@ -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', { @@ -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),