-
Notifications
You must be signed in to change notification settings - Fork 5
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
MNT Use React Testing Library #107
MNT Use React Testing Library #107
Conversation
expect(container.querySelector('.block-link-field__icon')).not.toBeNull() | ||
expect(container.querySelector('.block-link-field__content')).not.toBeNull() | ||
expect(container.querySelector('.block-link-field__actions')).not.toBeNull() |
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.
Should check for exactly one of each as per original test. This probably applies to other tests in this PR.
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 doing
test('BlockLinkField returns empty string if no relative URL provided', () => { | ||
const { container } = render( | ||
<BlockLinkField {...makeProps({ | ||
linkedPage: {}, | ||
})} | ||
/> | ||
); | ||
expect(container.querySelector('.block-link-field__link')).toBeNull(); | ||
}); |
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.
An element with no text inside (empty string) and simply not having an element are not the same thing. I accept that you can't test the internal function from the original test anymore, but we need to update the title to describe what we're actually testing now.
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 doing
client/src/components/BlockLinkField/tests/BlockLinkField-test.js
Outdated
Show resolved
Hide resolved
fbd9c43
to
a11b74b
Compare
a11b74b
to
a377fc2
Compare
Issue silverstripe/silverstripe-admin#1419