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

test: increase code coverage #784

Merged
merged 6 commits into from
Aug 19, 2020
Merged

test: increase code coverage #784

merged 6 commits into from
Aug 19, 2020

Conversation

hshoff
Copy link
Member

@hshoff hshoff commented Aug 19, 2020

This takes vx from 26% to 44% code coverage. More to come in future PRs...

🏠 Internal

  • [jest] ignore vx-demo, vx-vx code coverage
  • [annotation] 100% coverage
  • [bounds] 100% coverage

@hshoff hshoff added this to the 0.0.199 milestone Aug 19, 2020
const HOC = withBoundingRects(Component);
const wrapper = mount(<HOC />);
const RenderedComponent = wrapper.find(Component);
expect(RenderedComponent.prop('rect')).toEqual(emptyRect);
Copy link
Member Author

@hshoff hshoff Aug 19, 2020

Choose a reason for hiding this comment

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

🤔 wasn't sure how to mock the RenderComponent.node.parentNode to not have getBoundingRect which triggers the parentRect = emptyRect branch... so skipped it for now. Safe to assume it works.

Copy link
Collaborator

@williaster williaster left a comment

Choose a reason for hiding this comment

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

nice! 🙌 had one thought on the config, otherwise lgtm.

package.json Outdated Show resolved Hide resolved
@@ -1,54 +0,0 @@
import { withBoundingRects } from '../src';

// const expectedRectShape = expect.objectContaining({
Copy link
Collaborator

Choose a reason for hiding this comment

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

didn't know this was all commented out 😮

@@ -65,4 +65,15 @@ describe('<LinePathAnnotation />', () => {
),
).toBe(true);
});

test('it should have default x and y accessors', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could use it(...) function instead of test(...) too so it will read more like

it('should have default x and y accessors', ...)

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, i don't have a preference

@hshoff hshoff merged commit d1a6e53 into master Aug 19, 2020
@hshoff hshoff deleted the harry-cov branch August 19, 2020 19:52
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.

3 participants