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

refactor(pages): convert unit tests to use react-testing-library #6935

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

robinzigmond
Copy link
Contributor

Proposed behaviour

Pages component should have unit tests using React Testing Library

Current behaviour

unit tests use Enzyme

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

@@ -0,0 +1,178 @@
/* eslint-disable react/prop-types */
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: remove the eslint disable here

I don't believe it's required for this file and therefore can just be removed

@Parsium Parsium self-requested a review September 12, 2024 08:10
expect(screen.getByRole("heading")).toHaveTextContent("Page 2");
});

test("navigating to the next page should work as expected", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion(non-blocking): for this test and the succeeding one, what do you think about this so the expected behaviour is clearer?

Suggested change
test("navigating to the next page should work as expected", async () => {
test("navigating to the next page renders its content", async () => {

@robinzigmond robinzigmond marked this pull request as ready for review September 13, 2024 09:36
@robinzigmond robinzigmond requested a review from a team as a code owner September 13, 2024 09:36
@robinzigmond robinzigmond merged commit ebb1e2a into master Sep 13, 2024
25 checks passed
@robinzigmond robinzigmond deleted the FE-6617-pages-rtl branch September 13, 2024 09:40
@carbonci
Copy link
Collaborator

🎉 This PR is included in version 142.10.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
Development

Successfully merging this pull request may close these issues.

4 participants