-
-
Notifications
You must be signed in to change notification settings - Fork 697
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
support {a:1,b:2}.should.include({a:1})
#230
Conversation
looks like I need to clone the assertion to fix that test case. Anyone know how to do that properly? |
I just realized I'm not handling negations properly too so I'll need to refactor anyway |
To handle negation properly you will need to use: https://github.com/chaijs/chai/blob/master/lib/chai/utils/transferFlags.js |
karma... |
works but needs |
Yeah, we just shouldn't be using |
I had it using If it still doesn't work with the karma from npm, perhaps we could lock to a commit or tag from gh://karma... |
+1 Exactly what I was looking for in chai. |
is it possible to add multi-level objects support ? subject = {
a: 'a',
b: {
b1: 'b1',
b2: {
b21: 'b21',
b22: 'b22',
},
b3: {
b31: 'b31',
b32: 'b32',
},
},
};
subject.should.include({ b: { b2: { b22: 'b22' }}});
subject.should.include({ b: { b2: { b22: 'b22' }, b3: { b32: 'b32' }}});
subject.should.not.include({ b: { b4: 'b4' }});
subject.should.not.include({ b: { b2: { b22: 'x' }}}); |
What is missing to merge this in master? |
@vbardales would definitely be nice to be able to do deep includes. I've wanted it twice now since making this PR |
support `{a:1,b:2}.should.include({a:1})`
Originally added in chaijs#230, asserting that an object contains a subset of properties and values was never documented. Questions like chaijs#193 have popped up asking for this feature even though it's been present since 1.9.0. The discussion in chaijs#193 focused mostly around getting something like this to work via the `property` assertion, but that discussion should be considered moot by the existing functionality already present in `include` that was simply overlooked. Resolves: chaijs#193
Originally added in chaijs#230, asserting that an object contains a subset of properties and values was never documented. Questions like chaijs#193 have popped up asking for this feature even though it's been present since 1.9.0. The discussion in chaijs#193 focused mostly around getting something like this to work via the `property` assertion, but that discussion should be considered moot by the existing functionality already present in `include` that was simply overlooked. Resolves: chaijs#193
I also removed some type checking within the assert interface because it was getting in the way a bit. I hope thats ok.