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

feat: #1789 migrate chart tests to use react testing library #1874

Conversation

udayanshevade
Copy link
Contributor

Description

Migrate Chart and ChartControl tests to use React Testing Library instead of Enzyme

More Details

In addition to updating the tests, this PR also adds a couple of other optional dev dependencies:

  • @testing-library/user-event:
    Although the fireEvent that comes with RTL is sufficient for the purpose of this PR, I saw that this dependency came recommended, so I thought to include it here. If its inclusion here is premature, I can definitely roll it back.

  • canvas:
    Although the tests still pass without this one, it was displaying the error below (in the Screenshots section).

Corresponding Issue

#1789

Screenshots

Screen Shot 2020-10-04 at 12 09 36 AM

As always, if anything looks out of place (or missing), please LMK and I'll make the necessary changes.

Thank you! ☕


Reviewing this pull request? Check out our Code Review Practices guide if you haven't already!

@udayanshevade
Copy link
Contributor Author

I also noticed a really minor issue that the second hex string in these colorSchemes appears incorrect. It makes areas in some charts appear grey. Rather than guessing a good value, I decided not to include that yet. I'm not as good with color and I kind of liked the grey.

@udayanshevade udayanshevade changed the title Feat 1789 migrate chart tests use react testing library feat: #1789 migrate chart tests to use react testing library Oct 4, 2020
Copy link
Member

@julianguyen julianguyen left a comment

Choose a reason for hiding this comment

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

Awesome work! Thank you for migrating this :D

import { ChartControl } from 'components/Chart/ChartControl';

/**
* Canvas is tricky to test with 'react-testing-library', so this file mocks
Copy link
Member

Choose a reason for hiding this comment

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

Good call!

@julianguyen julianguyen merged commit f83246b into ifmeorg:main Oct 4, 2020
@udayanshevade udayanshevade deleted the feat-1789-migrate-chart-tests-use-react-testing-library branch October 18, 2020 01:26
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.

2 participants