node/test/parallel/test-url-canParse-whatwg.js
Khafra 6675505686
src: add v8 fast api for url canParse
PR-URL: https://github.com/nodejs/node/pull/47552
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
2023-04-20 16:16:21 +00:00

20 lines
373 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
// One argument is required
assert.throws(() => {
URL.canParse();
}, {
code: 'ERR_MISSING_ARGS',
name: 'TypeError',
});
{
// This test is to ensure that the v8 fast api works.
for (let i = 0; i < 1e5; i++) {
assert(URL.canParse('https://www.example.com/path/?query=param#hash'));
}
}