summaryrefslogtreecommitdiff
path: root/test/parallel/test-url-format-invalid-input.js
blob: 5a39cc1381d16f624ce3bdce6527417f6c96533c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';
require('../common');
const assert = require('assert');
const url = require('url');

// https://github.com/nodejs/node/pull/1036
const throws = [
  undefined,
  null,
  true,
  false,
  0,
  function() {}
];
for (let i = 0; i < throws.length; i++) {
  assert.throws(function() { url.format(throws[i]); }, TypeError);
}
assert.strictEqual(url.format(''), '');
assert.strictEqual(url.format({}), '');