mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
59220bb08a
PR-URL: https://github.com/nodejs/node/pull/54636 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
31 lines
600 B
JavaScript
31 lines
600 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
|
|
const assert = require('node:assert');
|
|
const url = require('node:url');
|
|
const { test } = require('node:test');
|
|
|
|
test('format invalid input', () => {
|
|
const throwsObjsAndReportTypes = [
|
|
undefined,
|
|
null,
|
|
true,
|
|
false,
|
|
0,
|
|
function() {},
|
|
Symbol('foo'),
|
|
];
|
|
|
|
for (const urlObject of throwsObjsAndReportTypes) {
|
|
assert.throws(() => {
|
|
url.format(urlObject);
|
|
}, {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
name: 'TypeError',
|
|
});
|
|
}
|
|
assert.strictEqual(url.format(''), '');
|
|
assert.strictEqual(url.format({}), '');
|
|
});
|