-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: migrate more modules to jest #16533
Conversation
// 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(); |
There was a problem hiding this comment.
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:
aws-cdk/packages/@aws-cdk/aws-ecs-patterns/test/ec2/test.l3s-v2.ts
Lines 270 to 273 in c6c5941
// 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.
There was a problem hiding this comment.
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.
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 CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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). |
Migrates
aws-ecs-patterns
andaws-sqs
tojest
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license