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

Make use of jest .toMatchSnapshot in library unit tests #236

Closed
danielcaldas opened this issue Sep 29, 2019 · 3 comments
Closed

Make use of jest .toMatchSnapshot in library unit tests #236

danielcaldas opened this issue Sep 29, 2019 · 3 comments

Comments

@danielcaldas
Copy link
Owner

Describe the issue
Currently there are a lot of cases where it makes sense to use .toMatchSnapshot instead of .toEqual.

Expected
In tests such as this example of graph.builder.spec.js, replace usages of super verbose and gigantic toEqual for toMatchSnapshot.

Example:

expect(props).toEqual({
    ...that.node,
    className: "node",
    cursor: "pointer",
    cx: 1,
    cy: 2,
    dx: 15.5,
    fill: "red",
    fontSize: 12,
    fontWeight: "bold",
    fontColor: "black",
    id: "id",
    label: "id",
    onClickNode: undefined,
    onRightClickNode: undefined,
    onMouseOut: undefined,
    onMouseOverNode: undefined,
    opacity: 1,
    renderLabel: true,
    size: 200,
    stroke: "yellow",
    strokeWidth: 2,
    svg: "file.svg",
    type: "circle",
    viewGenerator: null,
    overrideGlobalViewGenerator: undefined,
});

Files that should be tackled

Feel free to look around for other use cases that might make sense.

@jaydinsweo
Copy link
Contributor

I would like to take this issue 👍🏻

@danielcaldas
Copy link
Owner Author

Go for it @nguyenami 💪

@danielcaldas
Copy link
Owner Author

Closing this with #243

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants