-
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
feat(assertions): Add the hasNoXXX
methods.
#19330
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.
Thanks for submitting this @joe-king-sh! Can you add a line or two about these APIs in the README?
@kaizen3031593 |
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.
Looks great @joe-king-sh! A few minor nits, along with changing the error message to be more descriptive.
return; | ||
} | ||
|
||
return `Stack has ${Object.keys(result.matches).length} messages.`; |
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.
return `Stack has ${Object.keys(result.matches).length} messages.`; | |
return `Expected no matches, but stack has ${Object.keys(result.matches).length} messages.`; |
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.
In addition to the above change, I think we should also be returning the matched messages in the error message.
It's possible someone looks for annotations.hasNoError('/Default/Fred', Match.anyValue())
and they should be able to know what error message they are getting.
}); | ||
|
||
test('no match', () => { | ||
expect(() => annotations.hasNoInfo('/Default/Qux', 'this is an info')).toThrowError(/Stack has 1 messages./); |
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.
expect(() => annotations.hasNoInfo('/Default/Qux', 'this is an info')).toThrowError(/Stack has 1 messages./); | |
expect(() => annotations.hasNoInfo('/Default/Qux', 'this is an info')) | |
.toThrowError(/Stack has 1 messages./); |
- `hasError()`, `findError()` and `hasNoError()` | ||
- `hasWarning()`,`findWarning()` and `hasNoWarning()` | ||
- `hasInfo()`, `findInfo()` and `hasNoInfo()` |
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.
- `hasError()`, `findError()` and `hasNoError()` | |
- `hasWarning()`,`findWarning()` and `hasNoWarning()` | |
- `hasInfo()`, `findInfo()` and `hasNoInfo()` | |
- `hasError()`, `hasNoError()`, and `findError()` | |
- `hasWarning()`, `hasNoWarning()`, and `findWarning()` | |
- `hasInfo()`, `hasNoInfo()`, and `findInfo()` |
@kaizen3031593 |
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.
Looks great @joe-king-sh! I just added a bit of formatting to the error message.
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). |
This PR adds
hasNoError
,hasNoWarning
, andhasNoInfo
methods to the Annotations assertions toolkit.Fixes #18874
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license