-
-
Notifications
You must be signed in to change notification settings - Fork 699
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
Nested include assertion on arrays #887
Comments
Hi @astorije thanks for sharing your thoughts. This feature seems really useful and IMO we could have it, but I'm not a big fan of using the I'm not sure this will be possible in v4 even after the I also think we don't necessarily need Lodash/Underscore to flatten an array of arrays, I think it would just be a matter of using If you want to read more about the Let me know if I misunderstood anything you've said or if you disagree with anything. Thanks 😄 |
In Chai v4, one approach would be: expect([
[0, "a", 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
]).to.have.nested.property("[0][1]", "a"); I think having a flag to allow |
We've added this to our Roadmap to make sure we come up with a sensible way to do this for Chai 5 - if there isn't one already. Our roadmap is here: https://github.com/chaijs/chai/projects/2! We'll be releasing chai 5 soon, but for now I'll close this issue because it is tracked on our roadmap. |
any progress in this @keithamus ? |
Matrices are often represented as arrays of arrays. There is no documentation for this, but it seems like this would be an acceptable statement:
It fails with the following
AssertionError
:Flattening the array being evaluated works (but there is no native
.flatten()
in JS, one needs to use Lodash/Underscore.js, or test against Immutable.js structures...), I was wondering if there was a better alternative.I guess depending on the possibility to do so, this issue can be seen as either:
question
: Am I missing an obvious assertion here? I know there is recent work for v4 arounddeep
/nested
, are there any changes that can make this possible?feature-request
: Would it be reasonable to update.deep.include()
to fit the example above?The text was updated successfully, but these errors were encountered: