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

Migrate ScoreCard.test.js from Enzyme to React Shallow Renderer #1653

Merged
merged 11 commits into from
Aug 12, 2023

Conversation

anshgoyalevil
Copy link
Member

@anshgoyalevil anshgoyalevil commented Aug 10, 2023

Which problem is this PR solving?

Description of the changes

How was this change tested?

  • It was tested by running the command yarn test -- -u to re-generate snapshots of the changed tests
  • After that, yarn test-ci ScoreCard.test.js --coverage was used to check if all tests pass and coverage is 100%

Checklist

Signed-off-by: Ansh Goyal <anshgoyal1704@gmail.com>
Signed-off-by: Ansh Goyal <anshgoyal1704@gmail.com>
@yurishkuro
Copy link
Member

please address comments in #1643

@anshgoyalevil
Copy link
Member Author

anshgoyalevil commented Aug 10, 2023

@yurishkuro
I have fixed the deps thing in this PR. Since, in the previous one, we gradually shifted from RTL to React Shallow Renderer, which is a transitive dep of React Test Renderer (Which is already installed inside jaeger-ui).
React-is is also the dep for React test renderer, so no need to install that separately.

About the @testing-library/react @testing-library/jest-dom deps, they don't need to be installed for the scope of this PR, but as we are using two functions from Enzyme, mount, and shallow. The shallow function just got replaced in this PR, the mount function still needs to use the @testing-library/react @testing-library/jest-dom deps as per the official migration guide
I have also tried migrating mount from enzyme to renderer from RTL, and it works.
So, basically, these two deps would still be installed while using the render function from RTL

@codecov
Copy link

codecov bot commented Aug 10, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (848bfa0) 96.01% compared to head (12f1cbd) 96.01%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1653   +/-   ##
=======================================
  Coverage   96.01%   96.01%           
=======================================
  Files         241      241           
  Lines        7558     7558           
  Branches     1984     1984           
=======================================
  Hits         7257     7257           
  Misses        301      301           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@anshgoyalevil
Copy link
Member Author

@yurishkuro Could you please also check this one.

anshgoyalevil and others added 4 commits August 12, 2023 10:00
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Signed-off-by: Ansh Goyal <anshgoyal1704@gmail.com>
Signed-off-by: Ansh Goyal <anshgoyal1704@gmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
Copy link
Member

Choose a reason for hiding this comment

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

my bad, I should've used formatted versions, just pushed an update

@@ -0,0 +1,102 @@
// Copyright (c) 2023 The Jaeger Authors
// Adopted from https://thesametech.com/snapshot-testing-in-rtl/
// Copyright (c) 2023 Ildar Sharafeev
Copy link
Member

Choose a reason for hiding this comment

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

Author's permission in this comment: #1653 (comment)

Signed-off-by: Yuri Shkuro <github@ysh.us>
yurishkuro
yurishkuro previously approved these changes Aug 12, 2023
@yurishkuro yurishkuro enabled auto-merge (squash) August 12, 2023 21:59
Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <github@ysh.us>
@yurishkuro yurishkuro merged commit 1bbafdc into jaegertracing:main Aug 12, 2023
8 checks passed
@yurishkuro
Copy link
Member

Nice job!

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.

None yet

3 participants