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

This compares the objects properly in toMatchElement #199

Closed
wants to merge 1 commit into from

Conversation

puneetar
Copy link

This compares the objects properly, rather than just equating the reference

This compares the objects properly, rather than just equating the reference
@blainekasten
Copy link
Collaborator

blainekasten commented Feb 14, 2018

Thanks for the PR!
But I don't believe this is the right fix. Ref #186

@see enzymejs/enzyme#1476

@puneetar
Copy link
Author

Oh, I see. We are comparing the debug strings.
In some cases, I notice that the debug strings don't match but using the equals function on the enzyme wrapper returns true. Don't know why that happens.

@finnigantime
Copy link
Contributor

This seems reasonable to me, but in the case where the expect fails, it's nice to show the diff in the debug strings to make it obvious what the tree diff is. That was the major advantage of comparing the debug strings. If you could use .equals() to compare but show the debug string diff (or some easily human-readable diff) in the case of expect failure, you'd have the best of both worlds. In either case, I think we want enzymejs/enzyme#1476 to get fixed.

@blainekasten
Copy link
Collaborator

@puneetar can you give me examples of cases you are describing?

@@ -25,7 +25,7 @@ function toMatchElement(

const actual = actualEnzymeWrapper.debug(options);
const expected = expectedWrapper.debug(options);
const pass = actual === expected;
const pass = actual.equals(expected);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This also won't work because actual is a string. You are wanting to do actualEnzymeWrapper.equals(expectedWrapper)

@blainekasten
Copy link
Collaborator

I'm closing this as it seems like the original PR is not responding to this, nor is the implementation correct. Feel free to keep talking here or open a new pr/issue.

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.

3 participants