Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Has own property on objects with nulll prototype #688

Closed
aryzing opened this issue Apr 24, 2016 · 3 comments
Closed

Has own property on objects with nulll prototype #688

aryzing opened this issue Apr 24, 2016 · 3 comments

Comments

@aryzing
Copy link
Contributor

aryzing commented Apr 24, 2016

I recently ran a test that involved testing an object with a null prototype using expect(obj).to.have.ownProperty('x'). The test failed because it had no access to Object.prototype.hasOwnProperty. Can the ownProperty method be tweaked to use call/apply instead? Asi in Object.prototype.hasOwnProperty.call(obj).

Specifically, I was thinking about line 1226

@meeber
Copy link
Contributor

meeber commented Apr 24, 2016

@aryzing Great catch! Sounds reasonable to me. It looks like your proposed solution is already used on line 5082 as well.

Are you interested in PRing it? This would be in lib/chai/core/assertions.js.

@aryzing
Copy link
Contributor Author

aryzing commented Apr 24, 2016

Sure! Thanks!

@meeber
Copy link
Contributor

meeber commented Apr 24, 2016

Hmm... We should also prolly add a test that demonstrates current failure for the expect/should interfaces. Not seeing any equivalent functionality in the assert interface, though.

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

No branches or pull requests

2 participants