-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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: add eslint-plugin-jest's valid-expect rule #16332
chore: add eslint-plugin-jest's valid-expect rule #16332
Conversation
packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js
Outdated
Show resolved
Hide resolved
No significant bundle size changes to report. Generated by 🚫 dangerJS |
expect(toHaveAttribute(genMarkup({className: 'a'}), ['class', 'a'])); | ||
expect(toHaveAttribute(genMarkup({className: 'a b'}), ['class', 'a b'])); | ||
expect(toHaveAttribute(genMarkup({className: ''}), ['class', ''])); | ||
expect(toHaveAttribute(genMarkup({className: 'a'}), ['class', 'a'])).toBe( |
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.
not really related to this PR, but toHaveAttribute
should probably be written as a custom matcher rather than a function which returns a boolean.
packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js
Outdated
Show resolved
Hide resolved
These were discovered by @SimenB in facebook#16332. We weren't making actual assertions on some values. This PR makes the assertions, and fixes the tests.
These were discovered by @SimenB in facebook#16332. We weren't making actual assertions on some values. This PR makes the assertions, and fixes the tests.
Feel free to rebase from master, the fixes have landed |
ffcf919
to
57125d4
Compare
Awesome, thanks for dealing with it! |
Oops, this still needs a merge, sorry |
bd50029
to
962cdf5
Compare
rebased |
There are some assertions here which just doexpect(thing)
without a matcher, meaning it's not actually asserting anything (it does not work likeassert
). I added.toBe(true)
to them, and 2 of the tests are failing, meaning they are either wrong, or false negatives on master.The above is dated now that #16336 was merged, but it did uncover them 🙂