-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: expand test coverage for url.js #8976
Conversation
Currently Line 309 of lib/url.js is not reachable from test-url because there are no examples which has more than 255 characters in the hostname of the url. I added one example which can reach that line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if CI is good.
@@ -1200,6 +1204,17 @@ var formatTests = { | |||
pathname: '/' | |||
}, | |||
|
|||
// more than 255 characters in hostname which excesses the limit | |||
[excessHostnameUrl]: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Maybe get rid of excessHostnameUrl
const altogether and change this line to:
[`http://${'a'.repeat(255)}.com/node`]: {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
@@ -1200,6 +1204,17 @@ var formatTests = { | |||
pathname: '/' | |||
}, | |||
|
|||
// more than 255 characters in hostname which excesses the limit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: excesses
-> exceeds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nits addressed and green CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with good CI and nits addressed
delete excessHostnameUrl and add exceeded hostname url directly.
Thank you for the nits. I have updated. |
@@ -999,6 +999,7 @@ for (const u in parseTestsWithQueryString) { | |||
|
|||
// some extra formatting tests, just to verify | |||
// that it'll format slightly wonky content to a valid url. | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please remove this empty line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry. I forgot to delete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
only flaky failures in CI. Will land this. |
|
Add url example with more than 255 characters in the hostname of the url. PR-URL: #8976 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Scratch that, botched the commit log message... landed correctly in 7084b9c |
Add url example with more than 255 characters in the hostname of the url. PR-URL: #8976 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Add url example with more than 255 characters in the hostname of the url. PR-URL: #8976 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: James M Snell <jasnell@gmail.com> Conflicts: test/parallel/test-url.js
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
test url
Description of change
Currently line 309 of lib/url.js is not reachable from test-url because there are no examples which have more than 255 characters in the hostname of the url.
I added one example which can reach that line.