Browse Source

test: expand test coverage for url.js

Currently, line 156 of lib/url.js is not reachable from test-url because
there is no example URL which has a white space in the front of the url.
I added one example which can reach that line.

PR-URL: https://github.com/nodejs/node/pull/8859
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Franziska Hinkelmann <fhinkel@vt.edu>
v4.x
Junshu Okamoto 8 years ago
committed by Myles Borins
parent
commit
347547a97e
  1. 11
      test/parallel/test-url.js

11
test/parallel/test-url.js

@ -157,6 +157,17 @@ var parseTests = {
path: '/Y' path: '/Y'
}, },
// whitespace in the front
' http://www.example.com/': {
href: 'http://www.example.com/',
protocol: 'http:',
slashes: true,
host: 'www.example.com',
hostname: 'www.example.com',
pathname: '/',
path: '/'
},
// + not an invalid host character // + not an invalid host character
// per https://url.spec.whatwg.org/#host-parsing // per https://url.spec.whatwg.org/#host-parsing
'http://x.y.com+a/b/c': { 'http://x.y.com+a/b/c': {

Loading…
Cancel
Save