-
Notifications
You must be signed in to change notification settings - Fork 29
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
Conversation
@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. |
@sunesimonsen yes of course, apologies I didn't do that up front - very much stumbled into this. |
@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.
6facb54
to
d7e5f5f
Compare
@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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks solid. 👍
There was a problem hiding this 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.
I'll merge this into v11 and do a new prerelease. |
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.