-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix expect(new Array(1)).toEqual([undefined]) failures on *some* platforms #1048
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
Conversation
var i; | ||
if(Array.isArray(x)) { | ||
for(i = 0; i < x.length; i++) { | ||
x[i] = x[i]; |
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.
😐
}); | ||
|
||
it('expands bracketed array notation with further nesting', function() { | ||
var input = {'marker[1].size.magnitude': 8}; | ||
var expected = {marker: [undefined, {size: {magnitude: 8}}]}; | ||
var computed = Lib.expandObjectPaths(input); | ||
expect(computed).toEqual(expected); | ||
expectLooseDeepEqual(computed, expected); |
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.
Instead of that custom assert routine, why not just have to expect
statements:
expect(computed.marker[0]).toBeUndefined();
expect(computed.marker[1]).toEqual({ size: { magnitude: 8 } });
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.
I can move the function inside this block, but ideally wanted to avoid manually digging through the objects.
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.
Yeah that make sense.
What about moving your new expectLooseDeepEqual
to assets/custom_matchers.js
?
@etpinard added |
💃 once test pass! Thanks! |
This test adds a helper function to the lib test in order to loosen the comparison to what we actually care about, which is array access, not array content.
Gross.