1'use strict'; 2const common = require('../common'); 3const assert = require('assert'); 4const url = require('url'); 5 6const throwsObjsAndReportTypes = [ 7 undefined, 8 null, 9 true, 10 false, 11 0, 12 function() {}, 13 Symbol('foo'), 14]; 15 16for (const urlObject of throwsObjsAndReportTypes) { 17 assert.throws(() => { 18 url.format(urlObject); 19 }, { 20 code: 'ERR_INVALID_ARG_TYPE', 21 name: 'TypeError', 22 message: 'The "urlObject" argument must be one of type object or string.' + 23 common.invalidArgTypeHelper(urlObject) 24 }); 25} 26assert.strictEqual(url.format(''), ''); 27assert.strictEqual(url.format({}), ''); 28