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

fix: updated existing enzyme tests to use react testing library #36303

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jciasenza
Copy link
Contributor

@jciasenza jciasenza commented Feb 26, 2025

Main changes

BlockBrowserContainer is no longer imported and MockedBlockBrowserContainer is used instead.

The Main component is rendered within a Redux Provider.
Mock props are passed to avoid external dependencies.
selectedBlock="some-selected-block": Indicates that there is a block selected by default.
reportDownloadEndpoint is being configured and used when it was not before.

Drop-down interaction tests
This test suite (Dropdown Interactions) checks the behavior of the dropdown menu in the UI when interacting with it. Two main aspects are tested:

Loading course blocks when opening dropdown menu

The main component is rendered.
Simulate a click on the dropdown menu ('Select a section or issue').
The fetchCourseBlocksMock function is expected to be called once with the courseId and excludedBlockTypes parameters.
Appearance and disappearance of the dropdown

The main component is rendered.
It is verified that the dropdown (container-browser-mock-block) is not visible initially.
A click on the dropdown is simulated and expected to appear with the block navigator class.
Click again and verify that the drop-down menu disappears.

Added the following dependencies:
"@testing-library/react": "^12.1.5":
"@testing-library/jest-dom": "^6.6.3":
"@testing-library/user-event": "^12.8.3",

Uninstalled enzyme dependencies:
"enzyme": "3.11.0",
"react-16-enzyme-adapter": "1.15.8",
"jest-enzyme": "7.1.2",

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Feb 26, 2025
@openedx-webhooks
Copy link

Thanks for the pull request, @jciasenza!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@brian-smith-tcril
Copy link
Contributor

After reading through the description of this PR, I noticed it only describes the difference between using enzyme and react testing library and a description of what the tests that have been updated are testing.

In my opinion, everything mentioned in the PR description would be covered by simply saying "updated existing enzyme tests to use react testing library."

The code changes in this PR, however, include changes that don't fall into that category - and the PR description does not mention those changes

For example:

  • BlockBrowserContainer is no longer being imported, and instead MockedBlockBrowserContainer is being used.
  • reportDownloadEndpoint is being set and used when it wasn't before.

Would you be able to update the description on this PR to explain why changes like the examples I provided are being made?

There is no need to explain the differences between RTL and enzyme, or why RTL is being used. As a project, we know we want to use RTL so no additional justification is needed.

@jciasenza jciasenza changed the title fix: enzyme testing replaced by react tester fix: updated existing enzyme tests to use react testing library Feb 26, 2025
@jciasenza
Copy link
Contributor Author

@brian-smith-tcril:
I am going over to explain well the steps I have taken so that it is clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Status: Waiting on Author
Development

Successfully merging this pull request may close these issues.

3 participants