|
1 |
| -import '@aws-cdk/assert-internal/jest'; |
| 1 | +import { Template } from '@aws-cdk/assertions'; |
2 | 2 | import * as cdk from '@aws-cdk/core';
|
3 | 3 | import { Group, ManagedPolicy, PolicyDocument, PolicyStatement, Role, ServicePrincipal, User } from '../lib';
|
4 | 4 |
|
@@ -49,7 +49,7 @@ describe('managed policy', () => {
|
49 | 49 | const group = new Group(stack, 'MyGroup');
|
50 | 50 | group.addManagedPolicy(policy);
|
51 | 51 |
|
52 |
| - expect(stack).toMatchTemplate({ |
| 52 | + Template.fromStack(stack).templateMatches({ |
53 | 53 | Resources: {
|
54 | 54 | MyManagedPolicy9F3720AE: {
|
55 | 55 | Type: 'AWS::IAM::ManagedPolicy',
|
@@ -89,7 +89,7 @@ describe('managed policy', () => {
|
89 | 89 | }),
|
90 | 90 | });
|
91 | 91 |
|
92 |
| - expect(stack).toMatchTemplate({ |
| 92 | + Template.fromStack(stack).templateMatches({ |
93 | 93 | Resources: {
|
94 | 94 | MyManagedPolicy9F3720AE: {
|
95 | 95 | Type: 'AWS::IAM::ManagedPolicy',
|
@@ -120,7 +120,7 @@ describe('managed policy', () => {
|
120 | 120 | statements: [new PolicyStatement({ resources: ['arn'], actions: ['sns:Subscribe'] })],
|
121 | 121 | });
|
122 | 122 |
|
123 |
| - expect(stack).toMatchTemplate({ |
| 123 | + Template.fromStack(stack).templateMatches({ |
124 | 124 | Resources: {
|
125 | 125 | MyManagedPolicy9F3720AE: {
|
126 | 126 | Type: 'AWS::IAM::ManagedPolicy',
|
@@ -148,7 +148,7 @@ describe('managed policy', () => {
|
148 | 148 | const group = new Group(stack, 'MyGroup');
|
149 | 149 | group.addManagedPolicy(policy);
|
150 | 150 |
|
151 |
| - expect(stack).toMatchTemplate({ |
| 151 | + Template.fromStack(stack).templateMatches({ |
152 | 152 | Resources: {
|
153 | 153 | MyManagedPolicy9F3720AE: {
|
154 | 154 | Type: 'AWS::IAM::ManagedPolicy',
|
@@ -192,7 +192,7 @@ describe('managed policy', () => {
|
192 | 192 | statements: [new PolicyStatement({ resources: ['*'], actions: ['dynamodb:PutItem'] })],
|
193 | 193 | });
|
194 | 194 |
|
195 |
| - expect(stack).toMatchTemplate({ |
| 195 | + Template.fromStack(stack).templateMatches({ |
196 | 196 | Resources: {
|
197 | 197 | User1E278A736: { Type: 'AWS::IAM::User' },
|
198 | 198 | Group1BEBD4686: { Type: 'AWS::IAM::Group' },
|
@@ -248,7 +248,7 @@ describe('managed policy', () => {
|
248 | 248 | p.attachToRole(role);
|
249 | 249 | p.attachToRole(role);
|
250 | 250 |
|
251 |
| - expect(stack).toMatchTemplate({ |
| 251 | + Template.fromStack(stack).templateMatches({ |
252 | 252 | Resources: {
|
253 | 253 | MyManagedPolicy9F3720AE: {
|
254 | 254 | Type: 'AWS::IAM::ManagedPolicy',
|
@@ -295,7 +295,7 @@ describe('managed policy', () => {
|
295 | 295 | p.attachToRole(new Role(stack, 'Role1', { assumedBy: new ServicePrincipal('test.service') }));
|
296 | 296 | p.addStatements(new PolicyStatement({ resources: ['*'], actions: ['dynamodb:GetItem'] }));
|
297 | 297 |
|
298 |
| - expect(stack).toMatchTemplate({ |
| 298 | + Template.fromStack(stack).templateMatches({ |
299 | 299 | Resources: {
|
300 | 300 | MyManagedPolicy9F3720AE: {
|
301 | 301 | Type: 'AWS::IAM::ManagedPolicy',
|
@@ -346,7 +346,7 @@ describe('managed policy', () => {
|
346 | 346 |
|
347 | 347 | policy.addStatements(new PolicyStatement({ resources: ['*'], actions: ['*'] }));
|
348 | 348 |
|
349 |
| - expect(stack).toMatchTemplate({ |
| 349 | + Template.fromStack(stack).templateMatches({ |
350 | 350 | Resources: {
|
351 | 351 | MyManagedPolicy9F3720AE: {
|
352 | 352 | Type: 'AWS::IAM::ManagedPolicy',
|
@@ -390,7 +390,7 @@ describe('managed policy', () => {
|
390 | 390 | group.addManagedPolicy(policy);
|
391 | 391 | role.addManagedPolicy(policy);
|
392 | 392 |
|
393 |
| - expect(stack).toMatchTemplate({ |
| 393 | + Template.fromStack(stack).templateMatches({ |
394 | 394 | Resources: {
|
395 | 395 | MyUserDC45028B: {
|
396 | 396 | Type: 'AWS::IAM::User',
|
@@ -466,7 +466,7 @@ describe('managed policy', () => {
|
466 | 466 | group.addManagedPolicy(policy);
|
467 | 467 | role.addManagedPolicy(policy);
|
468 | 468 |
|
469 |
| - expect(stack).toMatchTemplate({ |
| 469 | + Template.fromStack(stack).templateMatches({ |
470 | 470 | Resources: {
|
471 | 471 | MyUserDC45028B: {
|
472 | 472 | Type: 'AWS::IAM::User',
|
@@ -594,7 +594,7 @@ describe('managed policy', () => {
|
594 | 594 | value: mp.managedPolicyArn,
|
595 | 595 | });
|
596 | 596 |
|
597 |
| - expect(stack2).toMatchTemplate({ |
| 597 | + Template.fromStack(stack2).templateMatches({ |
598 | 598 | Outputs: {
|
599 | 599 | Output: {
|
600 | 600 | Value: {
|
|
0 commit comments