Skip to content

chore: migrate more modules to jest#16533

Merged
mergify[bot] merged 3 commits intoaws:masterfrom
kaizencc:jest-migrate-2
Sep 21, 2021
Merged

chore: migrate more modules to jest#16533
mergify[bot] merged 3 commits intoaws:masterfrom
kaizencc:jest-migrate-2

Conversation

@kaizencc
Copy link
Copy Markdown
Contributor

Migrates aws-ecs-patterns and aws-sqs to jest.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented Sep 17, 2021

@kaizencc kaizencc requested a review from nija-at September 17, 2021 17:54
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Sep 17, 2021
// THEN - stack does not contain a LaunchConfiguration
const template = SynthUtils.synthesize(stack, { skipValidation: true });
expect(template).not.toHaveResource('AWS::AutoScaling::LaunchConfiguration');
expect(() => SynthUtils.synthesize(stack)).toThrow();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nija-at I'd like a second pair of eyes on this test (there are 2 other tests with the same pattern as well). It is comparable to this test in nodeunit:

// THEN - stack does not contain a LaunchConfiguration
expect(stack, true).notTo(haveResource('AWS::AutoScaling::LaunchConfiguration'));
test.throws(() => expect(stack));

The issue in question is the use of expect(stack, true) as the true refers to setting skipValidation=true. Without it, the test returns a validation error and we cannot check if the stack contains LaunchConfiguration or not. Since the Jest expect() function does not allow this, I dove in and found SynthUtils.synthesize exposes such an option.

I'm not sure if this is the best way to go about this so I wanted to bring it to your attention.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Kaizen. This is fine for now.

When we migrate this module to 'assertions', we will need to make the validation succeed.

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Sep 21, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 2628510
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 3a486c4 into aws:master Sep 21, 2021
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Sep 21, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@kaizencc kaizencc deleted the jest-migrate-2 branch October 13, 2021 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution/core This is a PR that came from AWS.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants