mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: move a couple of tests over to using node:test
PR-URL: https://github.com/nodejs/node/pull/54582 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
097dcfcb1f
commit
c44d41b2d8
@ -1,21 +1,21 @@
|
||||
// Flags: --expose-internals
|
||||
// Flags: --expose-internals --no-warnings
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const { hasCrypto } = require('../common');
|
||||
|
||||
// This tests that the accessor properties do not raise assertions
|
||||
// when called with incompatible receivers.
|
||||
|
||||
const assert = require('assert');
|
||||
const { test } = require('node:test');
|
||||
|
||||
// Objects that call StreamBase::AddMethods, when setting up
|
||||
// their prototype
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const TTY = internalBinding('tty_wrap').TTY;
|
||||
const UDP = internalBinding('udp_wrap').UDP;
|
||||
const { TTY } = internalBinding('tty_wrap');
|
||||
const { UDP } = internalBinding('udp_wrap');
|
||||
|
||||
{
|
||||
// Should throw instead of raise assertions
|
||||
test('Should throw instead of raise assertions', () => {
|
||||
assert.throws(() => {
|
||||
UDP.prototype.fd; // eslint-disable-line no-unused-expressions
|
||||
}, TypeError);
|
||||
@ -36,20 +36,20 @@ const UDP = internalBinding('udp_wrap').UDP;
|
||||
'typeof property descriptor ' + property + ' is not \'object\''
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check
|
||||
// There are accessor properties in crypto too
|
||||
const crypto = internalBinding('crypto');
|
||||
test('There are accessor properties in crypto too', { skip: !hasCrypto }, () => {
|
||||
// There are accessor properties in crypto too
|
||||
const crypto = internalBinding('crypto'); // eslint-disable-line node-core/crypto-check
|
||||
|
||||
assert.throws(() => {
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
crypto.SecureContext.prototype._external;
|
||||
}, TypeError);
|
||||
assert.throws(() => {
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
crypto.SecureContext.prototype._external;
|
||||
}, TypeError);
|
||||
|
||||
assert.strictEqual(
|
||||
typeof Object.getOwnPropertyDescriptor(
|
||||
crypto.SecureContext.prototype, '_external'),
|
||||
'object'
|
||||
);
|
||||
}
|
||||
}
|
||||
assert.strictEqual(
|
||||
typeof Object.getOwnPropertyDescriptor(
|
||||
crypto.SecureContext.prototype, '_external'),
|
||||
'object'
|
||||
);
|
||||
});
|
||||
|
@ -1,5 +1,6 @@
|
||||
'use strict';
|
||||
require('../common');
|
||||
const { test } = require('node:test');
|
||||
|
||||
// This test ensures Math functions don't fail with an "illegal instruction"
|
||||
// error on ARM devices (primarily on the Raspberry Pi 1)
|
||||
@ -7,9 +8,11 @@ require('../common');
|
||||
// and https://code.google.com/p/v8/issues/detail?id=4019
|
||||
|
||||
// Iterate over all Math functions
|
||||
Object.getOwnPropertyNames(Math).forEach((functionName) => {
|
||||
if (!/[A-Z]/.test(functionName)) {
|
||||
// The function names don't have capital letters.
|
||||
Math[functionName](-0.5);
|
||||
}
|
||||
test('Iterate over all Math functions', () => {
|
||||
Object.getOwnPropertyNames(Math).forEach((functionName) => {
|
||||
if (!/[A-Z]/.test(functionName)) {
|
||||
// The function names don't have capital letters.
|
||||
Math[functionName](-0.5);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user