debitoor / chai-subset

"containSubset" object properties matcher for Chai
http://chaijs.com/plugins/chai-subset/
MIT License
82 stars 20 forks source link

Doesn't work with chai-things 'something'. #8

Closed MIvanchev closed 9 years ago

MIvanchev commented 9 years ago

Currently the following assertion fails:

[{ a: 'cat' }, { a: 'dog' }].should.include.something.that.containSubset({ a: 'cat' });

Also, a language chain 'containsSubset' would be great.

eagleeye commented 9 years ago

Hi @MIvanchev ! Try to use only chai-subset

[{ a: 'cat' }, { a: 'dog' }].should.containSubset([{a: 'cat'}])

In general chai-subset language chain works, for example

{petHouse: [{ a: 'cat' }, { a: 'dog' }]}.should.have.property('petHouse').to.containSubset([{a: 'cat'}])

So it seems that this problem with chai-things that provides include.something and not with chai-subset. Looking forward to hear from you if it helped or not

MIvanchev commented 9 years ago

Hi @eagleeye!

I just tested your suggestion and it seems to work fine :) Thank you for your help. Perhaps extra documenting this case would make it easier for newcomers!

Regards

eagleeye commented 9 years ago

@MIvanchev please make PR with improvements that you think will help. It's hard to see from developers perspective how this will work for newcomers. Check the bottom of Readme - few days ago i released new version of chai-subset that includes that part of Readme. In case if this is not enough - please make a PR)