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

Added testcases #2273

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

Conversation

NitinRamnani
Copy link

Description of the changes

  • Added testcases

How was this change tested?

  • Ran command yarn test
    ticks test js

utils test js

Checklist

Signed-off-by: Nitin Ramnani <[email protected]>
@NitinRamnani NitinRamnani requested a review from a team as a code owner April 20, 2024 03:40
@NitinRamnani NitinRamnani requested review from joe-elliott and removed request for a team April 20, 2024 03:40
Copy link

codecov bot commented Apr 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.59%. Comparing base (5428e8d) to head (4a549a0).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2273   +/-   ##
=======================================
  Coverage   96.59%   96.59%           
=======================================
  Files         254      254           
  Lines        7641     7641           
  Branches     1927     1927           
=======================================
  Hits         7381     7381           
  Misses        260      260           

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


it('should match snapshot', () => {
const wrapper = shallow(<Ticks endTime={200} numTicks={5} showLabels startTime={100} />);
expect(wrapper).toMatchSnapshot()
Copy link
Member

Choose a reason for hiding this comment

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

we are trying to move away from snapshot testing. What specifically are you trying to validate?

Copy link
Author

Choose a reason for hiding this comment

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

Trying to validate that if same props are passed, component should render same html. So in future if someone accidentally changes anything in the component, it will be caught by this testcase.

Copy link
Member

Choose a reason for hiding this comment

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

component should render same html

but the component is not obligated to render the same HTML. Its implementation can change and the test will fail, even though the implementation can still be functionally correct. Tests should be validating use-visible behavior, e.g. you asked for 5 ticks - the result should have 5 ticks.

Copy link
Author

@NitinRamnani NitinRamnani Apr 20, 2024

Choose a reason for hiding this comment

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

You are correct but if we are changing implementation then we should also update the testcase. Snapshot testcase make sure until we haven't made any change in component
then HTML shouldn't also change there by help us in catching any accidentally changes.

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.

2 participants