tj / should.js

BDD style assertions for node.js -- test framework agnostic
MIT License
2.75k stars 194 forks source link

Unexpected behavior of .containEql when target object has keys not in source object #189

Closed apadmarao closed 10 years ago

apadmarao commented 10 years ago

Hello,

sourceObject.containEql(targetObject) 

throws a TypeError when targetObject has keys not in the sourceObject. We expect an AssertionError to be thrown instead.

{}.should.containEql({foo: 'foo'}) // throws TypeError: Cannot read property 'should' of undefined

I am happy to submit a PR for this, if we agree on the expected behavior.

btd commented 10 years ago

Yes, looks like a bug, it should throw AssertionError.

btd commented 10 years ago

Fixed in 3.1.3