Property assertion fails when object has a field with undefined values #184

Closed
gamtiq opened this Issue Jul 6, 2013 · 6 comments

Comments

Projects
None yet
7 participants

gamtiq commented Jul 6, 2013

First of all, thank you for the excellent library!
The following assertions will fail:

expect({a: undefined}).to.have.property("a");
expect({a: undefined}).to.have.property("a", undefined);

molnarg commented Aug 21, 2013

+1, having a property should be tested with if (property in object) { ... }

sjberry commented Oct 21, 2014

New chai user here. Just ran into this issue. Is this waiting on a pull request?

Contributor

charlierudolph commented Oct 21, 2014

Yep. #210

yelworc commented Nov 14, 2014

I just fell over the inverse, i.e. I expected this to fail:
assert.notProperty({prop: undefined}, 'prop');
As far as I can see, this is covered by the PR (please correct me if I'm wrong).

Owner

keithamus commented Nov 14, 2014

#210 needs to be updated, or a new PR made. @devand123 - do you have time to update #210 with the comments made?

keithamus closed this in #308 Dec 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment