I am looking for the best way to match the following:
expect([
{
C1: \'xxx\',
C0: \'this causes it not to match.\'
}
]).to.deep.incl
chai-subset or chai-fuzzy might also perform what you're looking for.
Chai-subset should work like this:
expect([
{
C1: 'xxx',
C0: 'this causes it not to match.'
}
]).to.containSubset([{C1: 'xxx'}]);
Personally if I don't want to include another plugin I will use the property
or keys
matchers that chai includes:
([
{
C1: 'xxx',
C0: 'this causes it not to match.'
}
]).forEach(obj => {
expect(obj).to.have.key('C1'); // or...
expect(obj).to.have.property('C1', 'xxx');
});