blob: 5edda72979164eae7bf03bf052da8af78004fdc0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// Flags: --expose-internals
'use strict';
require('../common');
const { URL } = require('url');
const assert = require('assert');
let internalBinding;
try {
internalBinding = require('internal/test/binding').internalBinding;
} catch (e) {
console.log('using `test/parallel/test-whatwg-url-canparse` requires `--expose-internals`');
throw e;
}
const { canParse } = internalBinding('url');
// It should not throw when called without a base string
assert.strictEqual(URL.canParse('https://example.org'), true);
assert.strictEqual(canParse('https://example.org'), true);
|