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

test: refactor test assertions and comments in napi tests #18414

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions test/addons-napi/test_general/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ assert.strictEqual(test_general.testGetPrototype(baseObject),
Object.getPrototypeOf(baseObject));
assert.strictEqual(test_general.testGetPrototype(extendedObject),
Object.getPrototypeOf(extendedObject));
assert.ok(test_general.testGetPrototype(baseObject) !==
test_general.testGetPrototype(extendedObject),
'Prototypes for base and extended should be different');
// Prototypes for base and extended should be different.
assert.notStrictEqual(test_general.testGetPrototype(baseObject),
test_general.testGetPrototype(extendedObject));

// test version management functions
// expected version is currently 1
Expand Down Expand Up @@ -70,17 +70,15 @@ assert.strictEqual(test_general.derefItemWasCalled(), true,
// Assert that wrapping twice fails.
const x = {};
test_general.wrap(x);
assert.throws(function() {
test_general.wrap(x);
}, Error);
assert.throws(() => test_general.wrap(x), Error);

// Ensure that wrapping, removing the wrap, and then wrapping again works.
const y = {};
test_general.wrap(y);
test_general.removeWrap(y);
assert.doesNotThrow(function() {
test_general.wrap(y);
}, Error, 'Wrapping twice succeeds if a remove_wrap() separates the instances');
assert.doesNotThrow(() => test_general.wrap(y), Error,
'Wrapping twice succeeds if a remove_wrap()' +
' separates the instances');

// Ensure that removing a wrap and garbage collecting does not fire the
// finalize callback.
Expand Down