Skip to content

Commit

Permalink
chore(core): remove excess whitespace (aws#20664)
Browse files Browse the repository at this point in the history
This was getting on my nerves. The whitespace comes from migrating our testing suite to jest -- some of our automated migration scripts must have neglected to remove the excess new lines. Added a few new lines for formatting fidelity as well, which is what accounts for the + file diff.

----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
kaizencc authored and daschaa committed Jul 9, 2022
1 parent 3b1b0d9 commit b4a2e22
Show file tree
Hide file tree
Showing 33 changed files with 39 additions and 581 deletions.
4 changes: 0 additions & 4 deletions packages/@aws-cdk/core/test/annotations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const restore = process.env.CDK_BLOCK_DEPRECATIONS;
describe('annotations', () => {
afterEach(() => {
process.env.CDK_BLOCK_DEPRECATIONS = restore; // restore to the original value

});

test('addDeprecation() annotates the usage of a deprecated API', () => {
Expand All @@ -28,7 +27,6 @@ describe('annotations', () => {
message: 'The API @aws-cdk/core.Construct.node is deprecated: use @aws-Construct.construct instead. This API will be removed in the next major release',
},
]);

});

test('deduplicated per node based on "api"', () => {
Expand Down Expand Up @@ -64,7 +62,6 @@ describe('annotations', () => {
message: 'The API @aws-cdk/core.Construct.node is deprecated: use @aws-Construct.construct instead. This API will be removed in the next major release',
},
]);

});

test('CDK_BLOCK_DEPRECATIONS will throw if a deprecated API is used', () => {
Expand All @@ -76,7 +73,6 @@ describe('annotations', () => {
// THEN
process.env.CDK_BLOCK_DEPRECATIONS = '1';
expect(() => Annotations.of(c1).addDeprecation('foo', 'bar')).toThrow(/MyStack\/Hello: The API foo is deprecated: bar\. This API will be removed in the next major release/);

});
});

Expand Down
20 changes: 0 additions & 20 deletions packages/@aws-cdk/core/test/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ describe('app', () => {
'/stack2/s1c2/r2':
[{ type: 'aws:cdk:logicalId', data: 's1c2r25F685FFF' }],
});


});

test('context can be passed through CDK_CONTEXT', () => {
Expand All @@ -111,7 +109,6 @@ describe('app', () => {
const prog = new App();
expect(prog.node.tryGetContext('key1')).toEqual('val1');
expect(prog.node.tryGetContext('key2')).toEqual('val2');

});

test('context passed through CDK_CONTEXT has precedence', () => {
Expand All @@ -127,7 +124,6 @@ describe('app', () => {
});
expect(prog.node.tryGetContext('key1')).toEqual('val1');
expect(prog.node.tryGetContext('key2')).toEqual('val2');

});

test('context from the command line can be used when creating the stack', () => {
Expand All @@ -152,7 +148,6 @@ describe('app', () => {
},
},
});

});

test('setContext(k,v) can be used to set context programmatically', () => {
Expand All @@ -162,18 +157,15 @@ describe('app', () => {
},
});
expect(prog.node.tryGetContext('foo')).toEqual('bar');

});

test('setContext(k,v) cannot be called after stacks have been added because stacks may use the context', () => {
const prog = new App();
new Stack(prog, 's1');
expect(() => prog.node.setContext('foo', 'bar')).toThrow();

});

test('app.synth() performs validation first and if there are errors, it returns the errors', () => {

class Child extends Construct {
constructor(scope: Construct, id: string) {
super(scope, id);
Expand All @@ -183,7 +175,6 @@ describe('app', () => {
}

class Parent extends Stack {

}

const app = new App();
Expand All @@ -193,8 +184,6 @@ describe('app', () => {
new Child(parent, 'C2');

expect(() => app.synth()).toThrow(/Validation failed with the following errors/);


});

test('app.synthesizeStack(stack) will return a list of missing contextual information', () => {
Expand Down Expand Up @@ -248,8 +237,6 @@ describe('app', () => {
},
},
]);


});

/**
Expand All @@ -264,7 +251,6 @@ describe('app', () => {
});

expect(assembly.runtime).toEqual({ libraries: {} });

});

test('deep stack is shown and synthesized properly', () => {
Expand All @@ -288,8 +274,6 @@ describe('app', () => {
template: { Resources: { Res: { Type: 'CDK::BottomStack::Resource' } } },
},
]);


});

test('stacks are written to the assembly file in a topological order', () => {
Expand All @@ -314,8 +298,6 @@ describe('app', () => {
expect(artifactsIds.indexOf('StackA')).toBeLessThan(artifactsIds.indexOf('StackC'));
expect(artifactsIds.indexOf('StackB')).toBeLessThan(artifactsIds.indexOf('StackC'));
expect(artifactsIds.indexOf('StackC')).toBeLessThan(artifactsIds.indexOf('StackD'));


});

test('application support any type in context', () => {
Expand All @@ -330,8 +312,6 @@ describe('app', () => {
expect(app.node.tryGetContext('isString')).toEqual('string');
expect(app.node.tryGetContext('isNumber')).toEqual(10);
expect(app.node.tryGetContext('isObject')).toEqual({ isString: 'string', isNumber: 10 });


});
});

Expand Down
25 changes: 0 additions & 25 deletions packages/@aws-cdk/core/test/arn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('arn', () => {

expect(stack.resolve(arn)).toEqual(
stack.resolve(`arn:${pseudo.partition}:sqs:${pseudo.region}:${pseudo.accountId}:myqueuename`));

});

test('cannot rely on defaults when stack not known', () => {
Expand All @@ -42,7 +41,6 @@ describe('arn', () => {

expect(stack.resolve(arn)).toEqual(
'arn:aws-cn:dynamodb:us-east-1:123456789012:table/mytable/stream/label');

});

test('allow empty string in components', () => {
Expand All @@ -58,8 +56,6 @@ describe('arn', () => {

expect(stack.resolve(arn)).toEqual(
'arn:aws-cn:s3:::my-bucket');


});

testDeprecated('resourcePathSep can be set to ":" instead of the default "/"', () => {
Expand All @@ -76,7 +72,6 @@ describe('arn', () => {

expect(stack.resolve(arn)).toEqual(
stack.resolve(`arn:${pseudo.partition}:codedeploy:${pseudo.region}:${pseudo.accountId}:application:WordPress_App`));

});

testDeprecated('resourcePathSep can be set to "" instead of the default "/"', () => {
Expand All @@ -93,7 +88,6 @@ describe('arn', () => {

expect(stack.resolve(arn)).toEqual(
stack.resolve(`arn:${pseudo.partition}:ssm:${pseudo.region}:${pseudo.accountId}:parameter/parameter-name`));

});

test('fails if resourcePathSep is neither ":" nor "/"', () => {
Expand All @@ -104,7 +98,6 @@ describe('arn', () => {
resource: 'bar',
sep: 'x',
})).toThrow();

});

describeDeprecated('Arn.parse(s)', () => {
Expand All @@ -119,19 +112,16 @@ describe('arn', () => {
test('if the ARN doesnt have enough components', () => {
const stack = new Stack();
expect(() => stack.parseArn('arn:is:too:short')).toThrow(/The `resource` component \(6th component\) of an ARN is required/);

});

test('if "service" is not specified', () => {
const stack = new Stack();
expect(() => stack.parseArn('arn:aws::4:5:6')).toThrow(/The `service` component \(3rd component\) of an ARN is required/);

});

test('if "resource" is not specified', () => {
const stack = new Stack();
expect(() => stack.parseArn('arn:aws:service:::')).toThrow(/The `resource` component \(6th component\) of an ARN is required/);

});
});

Expand Down Expand Up @@ -236,8 +226,6 @@ describe('arn', () => {
const evaluatedArnComponents = evaluateCFN(cfnArnComponents, { TheArn: arn });
expect(evaluatedArnComponents).toEqual(parsedComponents);
}


});

test('a Token with : separator', () => {
Expand All @@ -252,8 +240,6 @@ describe('arn', () => {
expect(stack.resolve(parsed.resource)).toEqual({ 'Fn::Select': [5, { 'Fn::Split': [':', theToken] }] });
expect(stack.resolve(parsed.resourceName)).toEqual({ 'Fn::Select': [6, { 'Fn::Split': [':', theToken] }] });
expect(parsed.sep).toEqual(':');


});

test('a Token with / separator', () => {
Expand All @@ -267,8 +253,6 @@ describe('arn', () => {
expect(stack.resolve(parsed.resource)).toEqual({ 'Fn::Select': [0, { 'Fn::Split': ['/', { 'Fn::Select': [5, { 'Fn::Split': [':', theToken] }] }] }] });
// eslint-disable-next-line max-len
expect(stack.resolve(parsed.resourceName)).toEqual({ 'Fn::Select': [1, { 'Fn::Split': ['/', { 'Fn::Select': [5, { 'Fn::Split': [':', theToken] }] }] }] });


});

test('extracting resource name from a complex ARN', () => {
Expand All @@ -283,17 +267,13 @@ describe('arn', () => {
expect(evaluateCFN(stack.resolve(parsed), {
SomeParameter: 'arn:aws:iam::111111111111:role/path/to/role/name',
})).toEqual('path/to/role/name');


});

test('extractResourceName validates resource type if possible', () => {
// WHEN
expect(() => {
Arn.extractResourceName('arn:aws:iam::111111111111:banana/rama', 'role');
}).toThrow(/Expected resource type/);


});

test('returns empty string ARN components', () => {
Expand All @@ -311,7 +291,6 @@ describe('arn', () => {
};

expect(stack.parseArn(arn)).toEqual(expected);

});
});

Expand Down Expand Up @@ -340,8 +319,6 @@ describe('arn', () => {
},
},
});


});

testDeprecated('parse other fields if only some are tokens', () => {
Expand All @@ -359,7 +336,5 @@ describe('arn', () => {
expect(stack.resolve(parsed.resource)).toEqual('role');
expect(stack.resolve(parsed.resourceName)).toEqual('S3Access');
expect(parsed.sep).toEqual('/');


});
});
4 changes: 0 additions & 4 deletions packages/@aws-cdk/core/test/aspect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ describe('aspect', () => {
expect(root.visitCounter).toEqual(1);
app.synth();
expect(root.visitCounter).toEqual(1);

});

test('Warn if an Aspect is added via another Aspect', () => {
Expand All @@ -54,7 +53,6 @@ describe('aspect', () => {
expect(root.node.metadata[0].data).toEqual('We detected an Aspect was added via another Aspect, and will not be applied');
// warning is not added to child construct
expect(child.node.metadata.length).toEqual(0);

});

test('Do not warn if an Aspect is added directly (not by another aspect)', () => {
Expand All @@ -70,7 +68,5 @@ describe('aspect', () => {
// no warning is added
expect(root.node.metadata.length).toEqual(1);
expect(child.node.metadata.length).toEqual(1);

});

});
4 changes: 0 additions & 4 deletions packages/@aws-cdk/core/test/assets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ describe('assets', () => {
},
},
});


});

test('addFileAsset correctly sets object urls', () => {
Expand All @@ -69,8 +67,6 @@ describe('assets', () => {
assetLocation.s3ObjectUrl.replace(expectedS3UrlPrefix, '')).toEqual(
assetLocation.httpUrl.replace(expectedHttpUrlPrefix, ''),
);


});

test('addDockerImageAsset correctly sets metadata', () => {
Expand Down
Loading

0 comments on commit b4a2e22

Please sign in to comment.