1
- import '@aws-cdk/assert-internal/jest ' ;
1
+ import { Template } from '@aws-cdk/assertions ' ;
2
2
import { Attribute , AttributeType , StreamViewType , Table } from '@aws-cdk/aws-dynamodb' ;
3
3
import { describeDeprecated , testDeprecated } from '@aws-cdk/cdk-build-tools' ;
4
4
import { App , CfnOutput , Stack } from '@aws-cdk/core' ;
@@ -26,7 +26,7 @@ describeDeprecated('Default Global DynamoDB stack', () => {
26
26
const topStack = stack . node . findChild ( CONSTRUCT_NAME ) as Stack ;
27
27
for ( const reg of STACK_PROPS . regions ) {
28
28
const tableStack = topStack . node . findChild ( CONSTRUCT_NAME + '-' + reg ) as Stack ;
29
- expect ( tableStack ) . toHaveResource ( 'AWS::DynamoDB::Table' , {
29
+ Template . fromStack ( tableStack ) . hasResourceProperties ( 'AWS::DynamoDB::Table' , {
30
30
'KeySchema' : [
31
31
{
32
32
'AttributeName' : 'hashKey' ,
@@ -46,12 +46,12 @@ describeDeprecated('Default Global DynamoDB stack', () => {
46
46
} ) ;
47
47
}
48
48
const customResourceStack = stack . node . findChild ( CONSTRUCT_NAME + '-CustomResource' ) as Stack ;
49
- expect ( customResourceStack ) . toHaveResource ( 'AWS::Lambda::Function' , {
49
+ Template . fromStack ( customResourceStack ) . hasResourceProperties ( 'AWS::Lambda::Function' , {
50
50
Description : 'Lambda to make DynamoDB a global table' ,
51
51
Handler : 'index.handler' ,
52
52
Timeout : 300 ,
53
53
} ) ;
54
- expect ( customResourceStack ) . toHaveResource ( 'AWS::CloudFormation::CustomResource' , {
54
+ Template . fromStack ( customResourceStack ) . hasResourceProperties ( 'AWS::CloudFormation::CustomResource' , {
55
55
Regions : STACK_PROPS . regions ,
56
56
ResourceType : 'Custom::DynamoGlobalTableCoordinator' ,
57
57
TableName : TABLE_NAME ,
@@ -75,7 +75,7 @@ testDeprecated('GlobalTable generated stacks inherit their account from the pare
75
75
value : globalTable . regionalTables [ 0 ] . tableStreamArn ! ,
76
76
} ) ;
77
77
78
- expect ( stack ) . toMatchTemplate ( {
78
+ Template . fromStack ( stack ) . templateMatches ( {
79
79
'Outputs' : {
80
80
'DynamoDbOutput' : {
81
81
'Value' : {
0 commit comments