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: adjust the random number id for testing #874

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

Conversation

nataliosilveiraext
Copy link
Contributor

JIRA Issue

Description 📄

adjustment in the random number id for testing, when performing unit tests in other repositories it always generates a new id, making it impossible to perform unit tests with snapshots

[Enter the description of your changes]

Platforms 📲

  • Web
  • Mobile

Type of change 🔍

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested? 🧪

[Enter the tips to test this PR]

  • Unit Test
  • Snapshot Test

Checklist: 🔍

  • My code follows the contribution guide of this project Contributing Guide
  • Layout matches design prototype: FIGMA
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Screenshots 📸

[Upload your screenshots here]

Before After

Copy link
Collaborator

@wellhub-gsevla wellhub-gsevla left a comment

Choose a reason for hiding this comment

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

It happens due to this PR. useId hook from react is only available through versions >=18, so it was breaking many others project tests using react@<18.

In order to fix it, we have build our own useId implementation that provides a stable id, just like react's useId. But for testing we still need to ensure immutability due to snapshots testing. The way to achieve that behavior is to mock useId. Or to provide a test implementation through manual mock or module mapper.

You probably want to fix the issue into the project were the error is happening.

Just a thought, we may provide a yoga setup file, but I'm not sure if we should for this particular scenario.

Copy link

sonarqubecloud bot commented Feb 6, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants