Skip to content

Commit

Permalink
chore(dynamodb-global): migrate to Assertions (#18515)
Browse files Browse the repository at this point in the history
----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
skinny85 committed Jan 19, 2022
1 parent 6a869f5 commit 132ab87
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-dynamodb-global/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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',
Expand All @@ -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,
Expand All @@ -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': {
Expand Down

0 comments on commit 132ab87

Please sign in to comment.