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

LocalizedMoment: refactor tests to @testing-library/react #68571

Merged
merged 1 commit into from
Oct 4, 2022

Conversation

flootr
Copy link
Contributor

@flootr flootr commented Oct 4, 2022

Proposed Changes

  • LocalizedMoment: refactor tests to @testing-library/react

Testing Instructions

  • Verify unit tests still pass

Related to #63409

@flootr flootr self-assigned this Oct 4, 2022
@github-actions
Copy link

github-actions bot commented Oct 4, 2022

@flootr flootr marked this pull request as ready for review October 4, 2022 10:47
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Oct 4, 2022
@flootr flootr requested a review from a team October 4, 2022 10:47
@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

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

This looks great! I left a minor suggestion, but it's totally optional.

🚀

<MomentProvider store={ store }>
<LocalizedLabel date="2018-11-01" />
</MomentProvider>
);

expect( wrapper.text() ).toEqual( enLabel );
expect( container.firstChild ).toHaveTextContent( enLabel );
Copy link
Member

Choose a reason for hiding this comment

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

We could use screen queries here if we want:

Suggested change
expect( container.firstChild ).toHaveTextContent( enLabel );
expect( screen.getByText( enLabel ) ).toBeVisible();

This is as recommended by the Kent C. Dodds here and is applicable for the rest of the PR.

@flootr flootr merged commit 21a80a3 into trunk Oct 4, 2022
@flootr flootr deleted the update/tests/localized-moment branch October 4, 2022 15:23
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants