Skip to content

feat: [prefer-in-document] Detect and auto-fix toBeFalsy() and toBeTruthy() #172

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

Merged

Conversation

julienw
Copy link
Contributor

@julienw julienw commented May 10, 2021

What: Autofix toBeFalsy() to not.toBeInTheDocument() and toBeTruthy() to toBeInTheDocument().

Why: I noticed in our test code an occurrence of expect(queryByText(XXX)).toBeFalsy() which I think should be detected by this plugin.

How: I merely updated existing code.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged

@codecov
Copy link

codecov bot commented May 10, 2021

Codecov Report

Merging #172 (845a1d6) into master (85a3a20) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            master      #172    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           15        15            
  Lines          386       555   +169     
  Branches        71       152    +81     
==========================================
+ Hits           386       555   +169     
Impacted Files Coverage Δ
src/rules/prefer-in-document.js 100.00% <100.00%> (ø)
src/index.js 100.00% <0.00%> (ø)
src/assignment-ast.js 100.00% <0.00%> (ø)
src/rules/prefer-empty.js 100.00% <0.00%> (ø)
src/rules/prefer-focus.js 100.00% <0.00%> (ø)
src/createBannedAttributeRule.js 100.00% <0.00%> (ø)
src/rules/prefer-to-have-class.js 100.00% <0.00%> (ø)
src/rules/prefer-to-have-style.js 100.00% <0.00%> (ø)
src/rules/prefer-to-have-value.js 100.00% <0.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 85a3a20...845a1d6. Read the comment docs.

@julienw
Copy link
Contributor Author

julienw commented May 10, 2021

Wait, git gobbled up my last changes :-) it's all good now

@julienw julienw changed the title [prefer-in-document] Detect and auto-fix toBeFalsy() and toBeTruthy() feat: [prefer-in-document] Detect and auto-fix toBeFalsy() and toBeTruthy() May 10, 2021
@julienw julienw force-pushed the detect-to-falsy-prefer-in-document branch from b48bcd0 to 2355682 Compare May 10, 2021 16:39
@julienw julienw force-pushed the detect-to-falsy-prefer-in-document branch from 2355682 to 845a1d6 Compare May 10, 2021 16:40
@julienw
Copy link
Contributor Author

julienw commented May 10, 2021

Looks like you need to update the required checks in github :-)

@benmonro benmonro merged commit fae4203 into testing-library:master May 10, 2021
@benmonro
Copy link
Member

thanks again @julienw

@github-actions
Copy link

🎉 This PR is included in version 3.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants