Skip to content

Commit

Permalink
Merge branch 'main' into SankyRed/addCanaryResource
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jan 29, 2023
2 parents 6b5a6f1 + 0b25265 commit b157557
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appsync/lib/data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export abstract class BaseDataSource extends Construct {
serviceRoleArn: this.serviceRole?.roleArn,
...extended,
});
this.name = name;
this.name = supportedName;
this.api = props.api;
}

Expand Down
16 changes: 14 additions & 2 deletions packages/@aws-cdk/aws-appsync/test/appsync-none.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ describe('None Data Source configuration', () => {
});
});

test('appsync data source exports sanitised name', () => {
// WHEN
const ds = api.addNoneDataSource('ds', {
name: 'Produce-Custom',
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::AppSync::DataSource', {
Type: 'NONE',
Name: 'ProduceCustom',
});
expect(ds.name).toBe('ProduceCustom');
});

test('appsync configures name and description correctly', () => {
// WHEN
api.addNoneDataSource('ds', {
Expand Down Expand Up @@ -116,5 +130,3 @@ describe('adding none data source from imported api', () => {
});
});
});


0 comments on commit b157557

Please sign in to comment.