From 132ab879ab26ca763e635521f19907db4f5c3aed Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Wed, 19 Jan 2022 05:09:08 -0800 Subject: [PATCH] chore(dynamodb-global): migrate to Assertions (#18515) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-dynamodb-global/package.json | 2 +- .../aws-dynamodb-global/test/dynamodb-global.test.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/@aws-cdk/aws-dynamodb-global/package.json b/packages/@aws-cdk/aws-dynamodb-global/package.json index 88856d300eda9..61e2d44daab47 100644 --- a/packages/@aws-cdk/aws-dynamodb-global/package.json +++ b/packages/@aws-cdk/aws-dynamodb-global/package.json @@ -56,7 +56,7 @@ "constructs": "^3.3.69" }, "devDependencies": { - "@aws-cdk/assert-internal": "0.0.0", + "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/cdk-integ-tools": "0.0.0", "@aws-cdk/pkglint": "0.0.0", diff --git a/packages/@aws-cdk/aws-dynamodb-global/test/dynamodb-global.test.ts b/packages/@aws-cdk/aws-dynamodb-global/test/dynamodb-global.test.ts index 5a6a45d5be3a3..1d6f90d4a16ad 100644 --- a/packages/@aws-cdk/aws-dynamodb-global/test/dynamodb-global.test.ts +++ b/packages/@aws-cdk/aws-dynamodb-global/test/dynamodb-global.test.ts @@ -1,4 +1,4 @@ -import '@aws-cdk/assert-internal/jest'; +import { Template } from '@aws-cdk/assertions'; import { Attribute, AttributeType, StreamViewType, Table } from '@aws-cdk/aws-dynamodb'; import { describeDeprecated, testDeprecated } from '@aws-cdk/cdk-build-tools'; import { App, CfnOutput, Stack } from '@aws-cdk/core'; @@ -26,7 +26,7 @@ describeDeprecated('Default Global DynamoDB stack', () => { const topStack = stack.node.findChild(CONSTRUCT_NAME) as Stack; for ( const reg of STACK_PROPS.regions ) { const tableStack = topStack.node.findChild(CONSTRUCT_NAME + '-' + reg) as Stack; - expect(tableStack).toHaveResource('AWS::DynamoDB::Table', { + Template.fromStack(tableStack).hasResourceProperties('AWS::DynamoDB::Table', { 'KeySchema': [ { 'AttributeName': 'hashKey', @@ -46,12 +46,12 @@ describeDeprecated('Default Global DynamoDB stack', () => { }); } const customResourceStack = stack.node.findChild(CONSTRUCT_NAME + '-CustomResource') as Stack; - expect(customResourceStack).toHaveResource('AWS::Lambda::Function', { + Template.fromStack(customResourceStack).hasResourceProperties('AWS::Lambda::Function', { Description: 'Lambda to make DynamoDB a global table', Handler: 'index.handler', Timeout: 300, }); - expect(customResourceStack).toHaveResource('AWS::CloudFormation::CustomResource', { + Template.fromStack(customResourceStack).hasResourceProperties('AWS::CloudFormation::CustomResource', { Regions: STACK_PROPS.regions, ResourceType: 'Custom::DynamoGlobalTableCoordinator', TableName: TABLE_NAME, @@ -75,7 +75,7 @@ testDeprecated('GlobalTable generated stacks inherit their account from the pare value: globalTable.regionalTables[0].tableStreamArn!, }); - expect(stack).toMatchTemplate({ + Template.fromStack(stack).templateMatches({ 'Outputs': { 'DynamoDbOutput': { 'Value': {