-
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(appsync): clean up code and bugs for auth config #9847
Conversation
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.
can you change the title of this issue to be a chore
or a refactor
you can still have Closes #abcd in the commit body, but I don't think this belongs in the release changelog as it does not really resolve a user facing bug or alter the API
const when = () => { | ||
new appsync.GraphQLApi(stack, 'api', { | ||
name: 'api', | ||
schemaDefinition: appsync.SchemaDefinition.FILE, | ||
schemaDefinitionFile: path.join(__dirname, 'appsync.test.graphql'), | ||
authorizationConfig: { | ||
additionalAuthorizationModes: [{ | ||
authorizationType: appsync.AuthorizationType.API_KEY, | ||
}], | ||
}, | ||
}); | ||
}; | ||
|
||
// THEN | ||
expect(when).toThrowError('You can\'t duplicate API_KEY configuration. See https://docs.aws.amazon.com/appsync/latest/devguide/security.html'); | ||
}); |
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.
we typically wrap the code that throws with the when
i.e.
expect(() => { //code that throws
}).toThrowError("message");
I know this was already existing code, but let's align it with our normal conventions in this chore/refactor?
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 code is a little big tho.. are you suggesting just putting everything into the expect?
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.
yep, ultimately it requires the same amount of reading to understand the scenario where the error is thrown.
I'm not strongly opinionated here, just pointing out that it's not aligned with the style of the rest of the codebase
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). |
Added unit tests for default and additional auth config and cleaning up the code.
Fixes: #9846
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license