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

Address a number of issues with array-like "to satisfy". #550

Merged
merged 3 commits into from
Dec 31, 2018

Conversation

alexjeffburke
Copy link
Member

While trying to write tests for the expect context being passed to
an invocation of expect.it when satisfying array-like subjects some
other issues around key checking became apparent.

First, when a non-numerical property comparison is forced by it
being supplied on the RHS this should work. Secondly, in the case
of a non-numerical array-like there was an issue calculating how
many outstanding keys there were when enumerability differences
came into the picture. Both of the added test cases exercise this
thoroughly.

Note that this commit also fixes the context issue.

@sunesimonsen
Copy link
Member

sunesimonsen commented Dec 29, 2018

@alexjeffburke could I ask you to add the tests as the first commit and then the fix as a separate commit. It will be useful to see how it fails before this change.

@alexjeffburke
Copy link
Member Author

@sunesimonsen yes of course, apologies I didn't do that up front - very much stumbled into this.

@sunesimonsen
Copy link
Member

@alexjeffburke no problem, it will just make it a bit easier to review.

While trying to write a test for the expect context being passed to
an invocation of expect.it when satisfying array-like subjects some
other issues around key checking became apparent. Add regression
tests that thoroughly exercise these cases.
Note that the regression tests added in the previous commit do not
yet pass due to other key handling issues in the assertion.
This commit fixes key checking issues when satisfying array-like.
First, when a non-numerical property comparison is forced by it
being supplied on the RHS this should work. Secondly, in the case
of a non-numerical array-like there was an issue calculating how
many outstanding keys there were when enumerability differences
came into the picture. Fixes regression tests added in f44439d.
@alexjeffburke alexjeffburke force-pushed the fix/arrayLikeToSatisfyAndProperties branch from 6facb54 to d7e5f5f Compare December 29, 2018 20:59
@alexjeffburke
Copy link
Member Author

@sunesimonsen I've split this into three commits - the second commit is only the fix for the context which I hope helps highlight the need for the other changes.

Copy link
Member

@sunesimonsen sunesimonsen left a comment

Choose a reason for hiding this comment

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

This looks solid. 👍

Copy link
Member

@papandreou papandreou left a comment

Choose a reason for hiding this comment

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

Looks good, great find! 🚀

Would be curious to see a regression test for the second issue.

@papandreou
Copy link
Member

I'll merge this into v11 and do a new prerelease.

@papandreou papandreou merged commit 86bb4bc into v11 Dec 31, 2018
@papandreou papandreou deleted the fix/arrayLikeToSatisfyAndProperties branch December 31, 2018 13:26
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

3 participants