debitoor / chai-subset

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

feature sugestion: containSubsetInOrder #46

Closed piotr-s-brainhub closed 7 years ago

piotr-s-brainhub commented 7 years ago

In containSubset the order doesn't matter.

expect([{a: 3, b:90}, {a: 90}]).to.containSubset([{a: 90}, {a: 3}]) - it passes

It would be nice to have a method containSubsetInOrder

expect([{a: 3, b:90}, {a: 90}]).to.containSubsetInOrder([{a: 90}, {a: 3}]) - it should fail expect([{a: 3, b:90}, {a: 90}]).to.containSubsetInOrder([{a: 3}, {a: 90}]) - it should pass

eagleeye commented 7 years ago

It might be useful for some users, so Pull requests are welcome!

dan-kez commented 7 years ago

Definitely would love to see this.

ebdrup commented 7 years ago

Maybe thats for a different module to solve? Single purpose modules are good.

On 12 Oct 2016, at 23.03, Dan Kez notifications@github.com wrote:

Definitely would love to see this.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

oprogramador commented 7 years ago

I have created such a module https://github.com/oprogramador/chai-subset-in-order and registered it in npm as chai-subset-in-order.

eagleeye commented 7 years ago

@oprogramador that's the spirit! ;)