Skip to content
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

Conversation

emteknetnz
Copy link
Member

package.json Outdated Show resolved Hide resolved
Comment on lines 26 to 28
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()
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not doing

Comment on lines +93 to +103
test('BlockLinkField returns empty string if no relative URL provided', () => {
const { container } = render(
<BlockLinkField {...makeProps({
linkedPage: {},
})}
/>
);
expect(container.querySelector('.block-link-field__link')).toBeNull();
});
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not doing

@emteknetnz emteknetnz force-pushed the pulls/3.0/react-testing-library branch from fbd9c43 to a11b74b Compare May 1, 2023 00:44
@emteknetnz emteknetnz force-pushed the pulls/3.0/react-testing-library branch from a11b74b to a377fc2 Compare May 2, 2023 01:04
@GuySartorelli GuySartorelli merged commit 17c60d3 into silverstripe:3.0 May 2, 2023
@GuySartorelli GuySartorelli deleted the pulls/3.0/react-testing-library branch May 2, 2023 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants