Skip to content

Commit 50a56d2

Browse files
jun-okajasnell
authored andcommitted
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: #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>
1 parent bef4b3b commit 50a56d2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/parallel/test-url.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,17 @@ var parseTests = {
158158
path: '/Y'
159159
},
160160

161+
// whitespace in the front
162+
' http://www.example.com/': {
163+
href: 'http://www.example.com/',
164+
protocol: 'http:',
165+
slashes: true,
166+
host: 'www.example.com',
167+
hostname: 'www.example.com',
168+
pathname: '/',
169+
path: '/'
170+
},
171+
161172
// + not an invalid host character
162173
// per https://url.spec.whatwg.org/#host-parsing
163174
'http://x.y.com+a/b/c': {

0 commit comments

Comments
 (0)