-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(assertions): remove unnecessary condition for if statement in Template
#32028
Conversation
Template
in if statement
Template
in if statementTemplate
Template
Template
@@ -1368,7 +1368,28 @@ describe('Template', () => { | |||
}).toThrow(/dependency cycle/); | |||
}); | |||
|
|||
test('does not throw when given a template with cyclic dependencies if check is skipped', () => { | |||
test('throws when given a template with cyclic dependencies if skipCyclicalDependenciesCheck is false', () => { |
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.
The tests for the undefined case already exists above this test.
In the case of true
, not.toThrow
is used, so I didn't summarize with test.each
.
@@ -54,7 +54,7 @@ export class Template { | |||
|
|||
private constructor(template: { [key: string]: any }, templateParsingOptions: TemplateParsingOptions = {}) { | |||
this.template = template as TemplateType; | |||
if (!templateParsingOptions?.skipCyclicalDependenciesCheck ?? true) { | |||
if (!templateParsingOptions.skipCyclicalDependenciesCheck) { |
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.
Leaving a comment to confirm that skipCyclicalDependenciesCheck
is meant to default to false
, as is the behavior here.
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 main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
Reason for this change
The following is the code in the
Template
constructor in the assertions module:However, since the left operand (
!templateParsingOptions?.skipCyclicalDependenciesCheck
) is never undefined (null), the right operand (?? true
) should not be needed. And thetemplateParsingOptions
is not optional arg.Description of changes
Description of how you validated changes
A unit test.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license