node/test/parallel/test-env-newprotomethod-remove-unnecessary-prototypes.js
legendecas a7e5b413ef
src: split property helpers from node::Environment
PR-URL: https://github.com/nodejs/node/pull/44056
Refs: https://github.com/nodejs/node/issues/42528
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
2022-08-02 00:01:02 +08:00

20 lines
686 B
JavaScript

// Flags: --expose-internals
'use strict';
require('../common');
// This test ensures that unnecessary prototypes are no longer
// being generated by node::NewFunctionTemplate.
const assert = require('assert');
const { internalBinding } = require('internal/test/binding');
[
internalBinding('udp_wrap').UDP.prototype.bind6,
internalBinding('tcp_wrap').TCP.prototype.bind6,
internalBinding('udp_wrap').UDP.prototype.send6,
internalBinding('tcp_wrap').TCP.prototype.bind,
internalBinding('udp_wrap').UDP.prototype.close,
internalBinding('tcp_wrap').TCP.prototype.open,
].forEach((binding, i) => {
assert.strictEqual('prototype' in binding, false, `Test ${i} failed`);
});