Skip to content

Commit

Permalink
chore: Revert "chore: move modules from assert to assertions (#16628)" (
Browse files Browse the repository at this point in the history
#16740)

This reverts commit 5e452f8.

Similar to #16727, reverting the move to assertions until the correct API to use
for the combination of `matchTemplate` and `newStyleSynthesis` can be defined.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
njlynch committed Oct 11, 2021
1 parent 8a1acca commit 6997557
Show file tree
Hide file tree
Showing 41 changed files with 357 additions and 334 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/assert-internal": "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
1 change: 1 addition & 0 deletions packages/@aws-cdk/assets/test/compat.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { SymlinkFollowMode } from '@aws-cdk/core';
import '@aws-cdk/assert-internal/jest';
import { FollowMode } from '../lib';
import { toSymlinkFollow } from '../lib/compat';

Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/assets/test/staging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as fs from 'fs';
import * as path from 'path';
import { App, Stack } from '@aws-cdk/core';
import * as cxapi from '@aws-cdk/cx-api';
import '@aws-cdk/assert-internal/jest';
import { Staging } from '../lib';

describe('staging', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-acmpca/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/assert-internal": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-acmpca/test/acmpca.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@aws-cdk/assert-internal/jest';
import {} from '../lib';

test('No tests are specified for this package', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codeguruprofiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/assert-internal": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cdk-integ-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import '@aws-cdk/assert-internal/jest';
import {} from '../lib';

test('No tests are specified for this package', () => {
expect(true).toBe(true);
});
20 changes: 10 additions & 10 deletions packages/@aws-cdk/aws-codeguruprofiler/test/profiling-group.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Template } from '@aws-cdk/assertions';
import { expect, haveResourceLike } from '@aws-cdk/assert-internal';
import { AccountRootPrincipal, Role } from '@aws-cdk/aws-iam';
import { Stack } from '@aws-cdk/core';
import { ProfilingGroup, ComputePlatform } from '../lib';
Expand All @@ -17,7 +17,7 @@ describe('profiling group', () => {
const profilingGroup = ProfilingGroup.fromProfilingGroupArn(stack, 'MyProfilingGroup', 'arn:aws:codeguru-profiler:us-east-1:1234567890:profilingGroup/MyAwesomeProfilingGroup');
profilingGroup.grantRead(readAppRole);

Template.fromStack(stack).templateMatches({
expect(stack).toMatch({
'Resources': {
'ReadAppRole52FE6317': {
'Type': 'AWS::IAM::Role',
Expand Down Expand Up @@ -89,7 +89,7 @@ describe('profiling group', () => {
const profilingGroup = ProfilingGroup.fromProfilingGroupName(stack, 'MyProfilingGroup', 'MyAwesomeProfilingGroup');
profilingGroup.grantPublish(publishAppRole);

Template.fromStack(stack).templateMatches({
expect(stack).toMatch({
'Resources': {
'PublishAppRole9FEBD682': {
'Type': 'AWS::IAM::Role',
Expand Down Expand Up @@ -176,7 +176,7 @@ describe('profiling group', () => {
profilingGroupName: 'MyAwesomeProfilingGroup',
});

Template.fromStack(stack).templateMatches({
expect(stack).toMatch({
'Resources': {
'MyProfilingGroup829F0507': {
'Type': 'AWS::CodeGuruProfiler::ProfilingGroup',
Expand All @@ -195,17 +195,17 @@ describe('profiling group', () => {
computePlatform: ComputePlatform.AWS_LAMBDA,
});

Template.fromStack(stack).hasResourceProperties('AWS::CodeGuruProfiler::ProfilingGroup', {
expect(stack).to(haveResourceLike('AWS::CodeGuruProfiler::ProfilingGroup', {
'ComputePlatform': 'AWSLambda',
});
}));
});

test('default profiling group without name', () => {
const stack = new Stack();
new ProfilingGroup(stack, 'MyProfilingGroup', {
});

Template.fromStack(stack).templateMatches({
expect(stack).toMatch({
'Resources': {
'MyProfilingGroup829F0507': {
'Type': 'AWS::CodeGuruProfiler::ProfilingGroup',
Expand All @@ -222,7 +222,7 @@ describe('profiling group', () => {
new ProfilingGroup(stack, 'MyProfilingGroupWithAReallyLongProfilingGroupNameThatExceedsTheLimitOfProfilingGroupNameSize_InOrderToDoSoTheNameMustBeGreaterThanTwoHundredAndFiftyFiveCharacters_InSuchCasesWePickUpTheFirstOneTwentyCharactersFromTheBeginningAndTheEndAndConcatenateThemToGetTheIdentifier', {
});

Template.fromStack(stack).templateMatches({
expect(stack).toMatch({
'Resources': {
'MyProfilingGroupWithAReallyLongProfilingGroupNameThatExceedsTheLimitOfProfilingGroupNameSizeInOrderToDoSoTheNameMustBeGreaterThanTwoHundredAndFiftyFiveCharactersInSuchCasesWePickUpTheFirstOneTwentyCharactersFromTheBeginningAndTheEndAndConca4B39908C': {
'Type': 'AWS::CodeGuruProfiler::ProfilingGroup',
Expand All @@ -245,7 +245,7 @@ describe('profiling group', () => {

profilingGroup.grantPublish(publishAppRole);

Template.fromStack(stack).templateMatches({
expect(stack).toMatch({
'Resources': {
'MyProfilingGroup829F0507': {
'Type': 'AWS::CodeGuruProfiler::ProfilingGroup',
Expand Down Expand Up @@ -329,7 +329,7 @@ describe('profiling group', () => {

profilingGroup.grantRead(readAppRole);

Template.fromStack(stack).templateMatches({
expect(stack).toMatch({
'Resources': {
'MyProfilingGroup829F0507': {
'Type': 'AWS::CodeGuruProfiler::ProfilingGroup',
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codestarnotifications/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/assert-internal": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cdk-integ-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Template } from '@aws-cdk/assertions';
import '@aws-cdk/assert-internal/jest';
import * as cdk from '@aws-cdk/core';
import * as notifications from '../lib';
import {
Expand All @@ -24,7 +24,7 @@ describe('NotificationRule', () => {
events: ['codebuild-project-build-state-succeeded'],
});

Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', {
expect(stack).toHaveResourceLike('AWS::CodeStarNotifications::NotificationRule', {
Resource: project.projectArn,
EventTypeIds: ['codebuild-project-build-state-succeeded'],
});
Expand All @@ -41,7 +41,7 @@ describe('NotificationRule', () => {
],
});

Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', {
expect(stack).toHaveResourceLike('AWS::CodeStarNotifications::NotificationRule', {
Resource: repository.repositoryArn,
EventTypeIds: [
'codecommit-repository-pull-request-created',
Expand All @@ -65,7 +65,7 @@ describe('NotificationRule', () => {
targets: [slack],
});

Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', {
expect(stack).toHaveResourceLike('AWS::CodeStarNotifications::NotificationRule', {
Name: 'MyNotificationRule',
DetailType: 'FULL',
EventTypeIds: [
Expand All @@ -90,7 +90,7 @@ describe('NotificationRule', () => {
events: ['codebuild-project-build-state-succeeded'],
});

Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', {
expect(stack).toHaveResourceLike('AWS::CodeStarNotifications::NotificationRule', {
Name: 'MyNotificationRuleGeneratedFromId',
Resource: project.projectArn,
EventTypeIds: ['codebuild-project-build-state-succeeded'],
Expand All @@ -105,7 +105,7 @@ describe('NotificationRule', () => {
events: ['codebuild-project-build-state-succeeded'],
});

Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', {
expect(stack).toHaveResourceLike('AWS::CodeStarNotifications::NotificationRule', {
Name: 'ificationRuleGeneratedFromIdIsToooooooooooooooooooooooooooooLong',
Resource: project.projectArn,
EventTypeIds: ['codebuild-project-build-state-succeeded'],
Expand All @@ -121,7 +121,7 @@ describe('NotificationRule', () => {
events: ['codebuild-project-build-state-succeeded'],
});

Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', {
expect(stack).toHaveResourceLike('AWS::CodeStarNotifications::NotificationRule', {
Name: 'MyNotificationRule',
Resource: project.projectArn,
EventTypeIds: ['codebuild-project-build-state-succeeded'],
Expand All @@ -138,7 +138,7 @@ describe('NotificationRule', () => {
enabled: false,
});

Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', {
expect(stack).toHaveResourceLike('AWS::CodeStarNotifications::NotificationRule', {
Name: 'MyNotificationRule',
Resource: project.projectArn,
EventTypeIds: ['codebuild-project-build-state-succeeded'],
Expand All @@ -155,7 +155,7 @@ describe('NotificationRule', () => {
enabled: true,
});

Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', {
expect(stack).toHaveResourceLike('AWS::CodeStarNotifications::NotificationRule', {
Name: 'MyNotificationRule',
Resource: project.projectArn,
EventTypeIds: ['codebuild-project-build-state-succeeded'],
Expand All @@ -177,7 +177,7 @@ describe('NotificationRule', () => {

expect(rule.addTarget(topic)).toEqual(true);

Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', {
expect(stack).toHaveResourceLike('AWS::CodeStarNotifications::NotificationRule', {
Resource: project.projectArn,
EventTypeIds: ['codebuild-project-build-state-succeeded'],
Targets: [
Expand Down Expand Up @@ -206,7 +206,7 @@ describe('NotificationRule', () => {
],
});

Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', {
expect(stack).toHaveResourceLike('AWS::CodeStarNotifications::NotificationRule', {
Resource: pipeline.pipelineArn,
EventTypeIds: [
'codepipeline-pipeline-pipeline-execution-succeeded',
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/assert-internal": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
Expand Down
10 changes: 5 additions & 5 deletions packages/@aws-cdk/aws-events/test/archive.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Template } from '@aws-cdk/assertions';
import '@aws-cdk/assert-internal/jest';
import { Duration, Stack } from '@aws-cdk/core';
import { EventBus } from '../lib';
import { Archive } from '../lib/archive';
Expand All @@ -20,11 +20,11 @@ describe('archive', () => {
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Events::EventBus', {
expect(stack).toHaveResource('AWS::Events::EventBus', {
Name: 'Bus',
});

Template.fromStack(stack).hasResourceProperties('AWS::Events::Archive', {
expect(stack).toHaveResource('AWS::Events::Archive', {
EventPattern: {
account: [{
Ref: 'AWS::AccountId',
Expand Down Expand Up @@ -58,11 +58,11 @@ describe('archive', () => {
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Events::EventBus', {
expect(stack).toHaveResource('AWS::Events::EventBus', {
Name: 'Bus',
});

Template.fromStack(stack).hasResourceProperties('AWS::Events::Archive', {
expect(stack).toHaveResource('AWS::Events::Archive', {
EventPattern: {
'account': [{
Ref: 'AWS::AccountId',
Expand Down
28 changes: 14 additions & 14 deletions packages/@aws-cdk/aws-events/test/event-bus.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Template } from '@aws-cdk/assertions';
import '@aws-cdk/assert-internal/jest';
import * as iam from '@aws-cdk/aws-iam';
import { Aws, CfnResource, Stack, Arn } from '@aws-cdk/core';
import { EventBus } from '../lib';
Expand All @@ -12,7 +12,7 @@ describe('event bus', () => {
new EventBus(stack, 'Bus');

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Events::EventBus', {
expect(stack).toHaveResource('AWS::Events::EventBus', {
Name: 'Bus',
});

Expand All @@ -29,7 +29,7 @@ describe('event bus', () => {
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Events::EventBus', {
expect(stack).toHaveResource('AWS::Events::EventBus', {
Name: 'myEventBus',
});

Expand All @@ -46,7 +46,7 @@ describe('event bus', () => {
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Events::EventBus', {
expect(stack).toHaveResource('AWS::Events::EventBus', {
Name: 'aws.partner/PartnerName/acct1/repo1',
EventSourceName: 'aws.partner/PartnerName/acct1/repo1',
});
Expand All @@ -70,7 +70,7 @@ describe('event bus', () => {
},
});

Template.fromStack(stack).hasResourceProperties('Test::Resource', {
expect(stack).toHaveResource('Test::Resource', {
EventBusArn1: { 'Fn::GetAtt': ['BusEA82B648', 'Arn'] },
EventBusArn2: { 'Fn::GetAtt': ['BusEA82B648', 'Arn'] },
});
Expand Down Expand Up @@ -142,7 +142,7 @@ describe('event bus', () => {
});

// THEN
Template.fromStack(stack).hasResourceProperties('Test::Resource', {
expect(stack).toHaveResource('Test::Resource', {
EventBusName: { Ref: 'BusEA82B648' },
});

Expand All @@ -165,7 +165,7 @@ describe('event bus', () => {
});

// THEN
Template.fromStack(stack).hasResourceProperties('Test::Resource', {
expect(stack).toHaveResource('Test::Resource', {
EventBusArn: { 'Fn::GetAtt': ['BusEA82B648', 'Arn'] },
});

Expand Down Expand Up @@ -298,7 +298,7 @@ describe('event bus', () => {
EventBus.grantPutEvents(role);

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', {
expect(stack).toHaveResource('AWS::IAM::Policy', {
PolicyDocument: {
Statement: [
{
Expand Down Expand Up @@ -330,7 +330,7 @@ describe('event bus', () => {
EventBus.grantAllPutEvents(role);

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', {
expect(stack).toHaveResource('AWS::IAM::Policy', {
PolicyDocument: {
Statement: [
{
Expand Down Expand Up @@ -363,7 +363,7 @@ describe('event bus', () => {
eventBus.grantPutEventsTo(role);

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', {
expect(stack).toHaveResource('AWS::IAM::Policy', {
PolicyDocument: {
Statement: [
{
Expand Down Expand Up @@ -403,11 +403,11 @@ describe('event bus', () => {
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Events::EventBus', {
expect(stack).toHaveResource('AWS::Events::EventBus', {
Name: 'Bus',
});

Template.fromStack(stack).hasResourceProperties('AWS::Events::Archive', {
expect(stack).toHaveResource('AWS::Events::Archive', {
SourceArn: {
'Fn::GetAtt': [
'BusEA82B648',
Expand Down Expand Up @@ -456,11 +456,11 @@ describe('event bus', () => {
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Events::EventBus', {
expect(stack).toHaveResource('AWS::Events::EventBus', {
Name: 'Bus',
});

Template.fromStack(stack).hasResourceProperties('AWS::Events::Archive', {
expect(stack).toHaveResource('AWS::Events::Archive', {
SourceArn: {
'Fn::GetAtt': [
'BusEA82B648',
Expand Down
Loading

0 comments on commit 6997557

Please sign in to comment.