diff --git a/packages/aws-cdk-lib/aws-appsync/README.md b/packages/aws-cdk-lib/aws-appsync/README.md index 1f85e8bdedc08..b021b07da9597 100644 --- a/packages/aws-cdk-lib/aws-appsync/README.md +++ b/packages/aws-cdk-lib/aws-appsync/README.md @@ -23,6 +23,7 @@ type demo { } type Query { getDemos: [ demo! ] + getDemosConsistent: [Demo!] } input DemoInput { version: String! diff --git a/packages/aws-cdk-lib/aws-appsync/test/appsync-dynamodb.test.ts b/packages/aws-cdk-lib/aws-appsync/test/appsync-dynamodb.test.ts index ea566f24a99bb..3cffd2f4675c6 100644 --- a/packages/aws-cdk-lib/aws-appsync/test/appsync-dynamodb.test.ts +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync-dynamodb.test.ts @@ -20,6 +20,24 @@ beforeEach(() => { }); }); +describe('AppSync Resolvers Deployment', () => { + test('should deploy resolvers for all fields in the schema', () => { + const expectedResolvers = [ + { fieldName: 'getDemos', typeName: 'Query' }, + { fieldName: 'getDemosConsistent', typeName: 'Query' }, + { fieldName: 'addDemo', typeName: 'Mutation' } + ]; + + expectedResolvers.forEach(({ fieldName, typeName }) => { + Template.fromStack(stack).hasResource('AWS::AppSync::Resolver', { + ApiId: { Ref: 'baseApi' }, + FieldName: fieldName, + TypeName: typeName, + }); + }); + }); +}); + describe('DynamoDb Data Source configuration', () => { // GIVEN let table: db.Table;