Skip to content

fix testEnumerables on ObjectWrap#736

Closed
fholzer wants to merge 2 commits into
nodejs:masterfrom
fholzer:fix-object-wrap-testEnumerables
Closed

fix testEnumerables on ObjectWrap#736
fholzer wants to merge 2 commits into
nodejs:masterfrom
fholzer:fix-object-wrap-testEnumerables

Conversation

@fholzer

@fholzer fholzer commented May 24, 2020

Copy link
Copy Markdown
Contributor

The assertion on key length is broken. It's an assignment instead of a bool expression.
Also changes the tests for properties to the same style as the tests for "own properties."

@fholzer

fholzer commented May 25, 2020

Copy link
Copy Markdown
Contributor Author

Also since the key length assertion was broken, no one noticed that the key length actually changed because addition instance properties were added. (in e8935bd)

Comment thread test/objectwrap.js
assert(keys.includes("testGetSet"));
assert(keys.includes("testGetter"));
assert(keys.includes("testValue"));
assert(keys.includes("testMethod"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there are now 6, there should likely be an assert for the 2 additional methods right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I see, tests for those were added in the same commit the properties were added. See e8935bd#diff-ec20a47eb5374e448ec0794a5fb6ac6eR100
Though maybe I'm missing something...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just though that if it validates that the number is 6, then it would be followed by 6 asserts as to what those are. It's not clear to without taking more time to check that that the earlier

 assert(Object.keys(obj).length === 2);
    assert(Object.keys(obj).includes('ownProperty'));
    assert(Object.keys(obj).indexOf('ownPropertyT') >= 0);

covers that and if it it does it may may sense to still have the additional checks so that if the length is 6 we follow it with 6 checks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the check in 2405844

@mhdawson mhdawson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

mhdawson pushed a commit that referenced this pull request Jun 9, 2020
PR-URL: #736
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@mhdawson

mhdawson commented Jun 9, 2020

Copy link
Copy Markdown
Member

@fholzer thanks!. Landed as d463f02

@mhdawson mhdawson closed this Jun 9, 2020
kevindavies8 added a commit to kevindavies8/node-addon-api-Develop that referenced this pull request Aug 24, 2022
PR-URL: nodejs/node-addon-api#736
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Marlyfleitas added a commit to Marlyfleitas/node-api-addon-Development that referenced this pull request Aug 26, 2022
PR-URL: nodejs/node-addon-api#736
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
wroy7860 added a commit to wroy7860/addon-api-benchmark-node that referenced this pull request Sep 19, 2022
PR-URL: nodejs/node-addon-api#736
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
johnfrench3 pushed a commit to johnfrench3/node-addon-api-git that referenced this pull request Aug 11, 2023
PR-URL: nodejs/node-addon-api#736
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants