-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: move more url tests to
node:test
- Loading branch information
Showing
9 changed files
with
533 additions
and
528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const url = require('url'); | ||
|
||
const throwsObjsAndReportTypes = [ | ||
undefined, | ||
null, | ||
true, | ||
false, | ||
0, | ||
function() {}, | ||
Symbol('foo'), | ||
]; | ||
require('../common'); | ||
|
||
for (const urlObject of throwsObjsAndReportTypes) { | ||
assert.throws(() => { | ||
url.format(urlObject); | ||
}, { | ||
code: 'ERR_INVALID_ARG_TYPE', | ||
name: 'TypeError', | ||
message: 'The "urlObject" argument must be one of type object or string.' + | ||
common.invalidArgTypeHelper(urlObject) | ||
}); | ||
} | ||
assert.strictEqual(url.format(''), ''); | ||
assert.strictEqual(url.format({}), ''); | ||
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({}), ''); | ||
}); |
Oops, something went wrong.