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

Remove unit test that was comparing new/old reduce-css-calc #3868

Merged
merged 1 commit into from Oct 16, 2023

Conversation

PavelVanecek
Copy link
Collaborator

Why? It's not testing anything - it throws, and the error is not reported as a failing test but instead as a log message in the console.

Instead I have replaced it with a .not.toThrow() call which at least tests that our new implementation doesn't throw. The old one throws so I removed it completely.

Description

Related Issue

#3820

Motivation and Context

image

How Has This Been Tested?

Jest

Screenshots (if appropriate):

Types of changes

  • 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 change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have added a storybook story or extended an existing story to show my changes
  • All new and existing tests passed.

Why? It's not testing anything - it throws, and the error is not reported as a failing test but instead as a log message in the console.

Instead I have replaced it with a `.not.toThrow()` call which at least tests that our new implementation is correct.
The old one throws so I removed it completely.
if (!(prevCalc.includes('calc') || prevCalc.includes(' '))) {
expect(prevCalc).toEqual(newCalc);
}
} catch (e) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Test failures from expect are reported as an exception - so this catch turns this test into an always green one. Don't catch exceptions in tests.

Copy link
Member

Choose a reason for hiding this comment

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

Some of the tests were added to explicitly show that the old reduce css calc threw errors in those cases, but agreed should be maybe been a separate block with expect to throw

@ckifer ckifer merged commit 2939a44 into recharts:master Oct 16, 2023
5 checks passed
GMer78 pushed a commit to GMer78/recharts-1 that referenced this pull request Nov 24, 2023
@PavelVanecek PavelVanecek deleted the reduceCSSCalc-tests branch January 2, 2024 11:21
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

2 participants