You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to figure out the best way to use .deep and .include. According to #1009 (comment), it seems like latest version of chai.js should work with partial matches.
Here is a similar sample to what I am trying to achieve https://jsfiddle.net/whm06h05/ (setup with latest versions of chai and mocha as of today):
'use strict';mocha.setup("bdd");chai.should();describe('Include tests',()=>{constarray=[];array.push({a: 11.1,b: 'blah'});array.push({a: 12.1});it('should work with deep and exact object graph',()=>array.should.deep.include({a: 12.1}));// worksit('should work without deep and exact object graph',()=>array.should.include({a: 12.1}));// doesn't workit('should work with deep and partial object graph',()=>array.should.deep.include({a: 11.1}));// doesn't workit('should work without deep and partial object graph',()=>array.should.include({a: 11.1}));// doesn't work});mocha.run();
With the latest version of chai, is there a way to test partial match; certain member of object in an array matches a value?
The text was updated successfully, but these errors were encountered:
At current there is no way to do partial matching. deep should check all properties exhaustively, and so what you're hoping for with that code is not yet implemented. You should subscribe to #644 which is our tracking issue for implementing some kind of partial match.
I'll close this issue, as we should keep #644 as the main tracking issue for this feature.
I am trying to figure out the best way to use
.deep
and.include
. According to #1009 (comment), it seems like latest version of chai.js should work with partial matches.Here is a similar sample to what I am trying to achieve https://jsfiddle.net/whm06h05/ (setup with latest versions of chai and mocha as of today):
With the latest version of chai, is there a way to test partial match; certain member of object in an array matches a value?
The text was updated successfully, but these errors were encountered: