Skip to content

Commit

Permalink
Merge branch 'main' into appsync-association-depends-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Apr 9, 2024
2 parents da75292 + 49b4aa1 commit c363839
Show file tree
Hide file tree
Showing 12 changed files with 2,483 additions and 1 deletion.
10 changes: 10 additions & 0 deletions packages/@aws-cdk/integ-tests-alpha/lib/assertions/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export abstract class ExpectedResult {
* ExpectedResult.exact({
* stringParam: 'hello',
* });
*
* @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.assertions.Match.html#static-exactpattern
*/
public static exact(expected: any): ExpectedResult {
return {
Expand All @@ -74,11 +76,15 @@ export abstract class ExpectedResult {
* stringParam: 'hello',
* numberParam: 3,
* booleanParam: true,
* objectParam: { prop1: 'value', prop2: 'value' },
* };
* // pass
* ExpectedResult.objectLike({
* stringParam: 'hello',
* objectParam: { prop1: 'value' },
* });
*
* @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.assertions.Match.html#static-objectwbrlikepattern
*/
public static objectLike(expected: { [key: string]: any }): ExpectedResult {
return {
Expand Down Expand Up @@ -108,6 +114,8 @@ export abstract class ExpectedResult {
* stringParam: 'hello',
* },
* ]);
*
* @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.assertions.Match.html#static-arraywbrwithpattern
*/
public static arrayWith(expected: any[]): ExpectedResult {
return {
Expand All @@ -126,6 +134,8 @@ export abstract class ExpectedResult {
*
* // pass
* ExpectedResult.stringLikeRegexp('value');
*
* @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.assertions.Match.html#static-stringwbrlikewbrregexppattern
*/
public static stringLikeRegexp(expected: string): ExpectedResult {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class HttpApiCall extends ApiCallBase {

new CfnOutput(node, 'AssertionResults', {
value: result,
}).overrideLogicalId(`AssertionResults${id}`);
}).overrideLogicalId(`AssertionResults${id.replace(/[\W_]+/g, '')}`);
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,27 @@ describe('DeployAssert', () => {
}));
});

test('expect creates a valid CfnOutput', () => {
// GIVEN
const app = new App();
const deplossert = new DeployAssert(app);

// WHEN
const query = deplossert.httpApiCall('https://example.com/test/123?param=value&param2#hash');
query.expect(ExpectedResult.objectLike({ status: 200 }));

// THEN
Template.fromStack(deplossert.scope).hasOutput(
// Output name should only contain alphanumeric characters
'AssertionResultsHttpApiCallexamplecomtest1237c0018be9f253e38cad30092c2fa2a91',
{
Value: {
'Fn::GetAtt': ['HttpApiCallexamplecomtest1237c0018be9f253e38cad30092c2fa2a91', 'assertion'],
},
},
);
});

test('multiple calls can be configured', () => {
// GIVEN
const app = new App();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c363839

Please sign in to comment.