-
Notifications
You must be signed in to change notification settings - Fork 405
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
Adds toHaveErrorMessage assertion #258
Adds toHaveErrorMessage assertion #258
Conversation
Codecov Report
@@ Coverage Diff @@
## master #258 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 24 +1
Lines 315 323 +8
Branches 71 76 +5
=========================================
+ Hits 315 323 +8
Continue to review full report at Codecov.
|
I don't think what we need to check here is exactly all that Lines 6 to 11 in 159a7a2
I'm hesitant to extract such a simple functionality to a helper in utils, so feel free to copy the equivalent condition in that code to the file implementing this new assertion. As for the other part, I also do not think that However as we agreed on the discussion in the issue where you proposed this, I'd be ok if you omit that part, and we can add it when it becomes a problem. I'm not sure how to fully interpret the spec on this regard correctly. And also given that visibility is a tricky issue as it may be affected by the presence of stylesheets loaded in the document, something that usually in the context of jest tests of isolated components does not happen. We already have our fair share of issue reports of people complaining that matchers such as |
Thank you for the detailed response. I think that clarifies all my concerns |
@jacobparis sorry for having dropped the ball on this one for so many days. Those error messages look good to me. I updated this branch with the latest from master. Let's see how the CI behaves this time, and if it all passes I'll do a final review and approve and merge if everything's ok. |
@jacobparis Hi, could you, please, rebase this PR again to give @gnapse a chance to review and merge it? |
Any updates on this PR? I believe it's a better way to assert form validation rather than cc @kentcdodds . |
The CI checks have failures. There's an issue with the test coverage. I believe you have to add tests to cover for some lines that are not being tested. This often is related to there being no tests for the negative assertions. For instance, this often happens when you test that both It may help that you run |
Friendly ping. @jacobparis |
Friendly ping. @jacobparis |
Superseded by #370. |
What:
I implemented a basic toHaveErrorMessage assertion. It currently does not check for visibility (suggested by spec)
Original issue: #256
I'd like some recommendations for how to go about adding those two missing features. The logic to tell whether
aria-invalid
is set is already present in thetoBeInvalid
assertion andisVisible
is in a similar boat.My first reaction would be to reuse that functionality here, but as of right now there is no precedent in the codebase for one assertion to call the code of another.
I could re-implement it in this handler, but then there's two branches to maintain in parallel for the same functionality.
Checklist: