You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this is an issue I've found via the Code include assertion (which is basically just a wrapper around Hoek.contain. I've got an object with some properties defined with Object.define(). If the properties are marked as {enumerable: false} then contain fails to see them as defined. Here is a test which shows the issue.
importCodefrom"code";importLabfrom"lab";importHoekfrom"hoek";constlab=exports.lab=Lab.script();lab.it("Hoek.contain should not fail on definedProperties",(done)=>{consttest={"muffin": "Chocolate"};Object.defineProperty(test,"milkshake",{"value": "Chocolate","enumerable": true});Object.defineProperty(test,"cake",{"value": "Chocolate","enumerable": false});// This passesexpect(test.muffin,"test.muffin should equal").to.equal("Chocolate");expect(test.cake,"test.cake should equal").to.equal("Chocolate");expect(test.milkshake,"test.milkshake should equal").to.equal("Chocolate");expect(Hoek.contain(test,{"muffin": "Chocolate"}),"muffin should be a property").to.be.true();expect(Hoek.contain(test,{"milkshake": "Chocolate"}),"milkshake should be a property").to.be.true();// This does not - shouldn't it?expect(Hoek.contain(test,{"cake": "Chocolate"}),"cake should be a property").to.be.true();returndone();});
Is this by design or is it a bug?
Regards,
The text was updated successfully, but these errors were encountered:
It makes sense with the current implementation that it isn't able to match non-enumerable properties as it is implemented with Object.keys(...) which will only retrieve the enumerable properties.
Not sure if this is just a side effect or not, but wanted to see what was going on.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
lockbot
locked as resolved and limited conversation to collaborators
Jan 9, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi guys,
this is an issue I've found via the Code include assertion (which is basically just a wrapper around
Hoek.contain
. I've got an object with some properties defined withObject.define()
. If the properties are marked as{enumerable: false}
then contain fails to see them as defined. Here is a test which shows the issue.Is this by design or is it a bug?
Regards,
The text was updated successfully, but these errors were encountered: