| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
The test was changed to use countdown instead of validating if the index of the array of codes exceeded the size of the array. Also the validation that was before didn't allow to execute the last test, so the assert equal was to 5, and the last status in the array wasn't tested. The change was to assert 6 tests complete. Fixes: nodejs#17169
|
|
||
| process.on('exit', function() { | ||
| assert.strictEqual(5, testsComplete); | ||
| assert.strictEqual(6, testsComplete); |
There was a problem hiding this comment.
How about replacing 6 with tests.length ?
Sorry, something went wrong.
There was a problem hiding this comment.
This code can actually be removed, as well as the testsComplete variable. Since there's a Countdown now, there's no need to verify that all 6 test cases executed.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM but some small changes needed
Thank you for taking this on!
Sorry, something went wrong.
|
|
||
| process.on('exit', function() { | ||
| assert.strictEqual(5, testsComplete); | ||
| assert.strictEqual(6, testsComplete); |
There was a problem hiding this comment.
This code can actually be removed, as well as the testsComplete variable. Since there's a Countdown now, there's no need to verify that all 6 test cases executed.
Sorry, something went wrong.
| if (testIdx + 1 === tests.length) { | ||
| return s.close(); | ||
| } | ||
| const test = tests[testIdx]; |
There was a problem hiding this comment.
We can just do test = tests.shift() here (and not declare it as a const).
Sorry, something went wrong.
|
|
||
| let testsComplete = 0; | ||
| const tests = [200, 202, 300, 404, 451, 500]; | ||
| let testIdx = 0; |
There was a problem hiding this comment.
testsComplete and testIdx can be removed. Instead add let test;.
Sorry, something went wrong.
| const countdown = new Countdown(tests.length, () => s.close()); | ||
|
|
||
| const s = http.createServer(function(req, res) { | ||
| const t = tests[testIdx]; |
There was a problem hiding this comment.
This can be removed and then the assert.strictEqual() can compare to the top scope test variable.
Sorry, something went wrong.
| @@ -55,13 +54,14 @@ function nextTest() { | |||
| response.on('end', function() { | |||
| testsComplete++; | |||
| testIdx += 1; | |||
There was a problem hiding this comment.
These variable additions would both be removed.
Sorry, something went wrong.
The test was changed to use countdown instead of validating if the index of the array of codes exceeded the size of the array. Also the validation that was before didn't allow to execute the last test, so the assert equal was to 5, and the last status in the array wasn't tested. The change was to assert 6 tests complete. Variable testIdx to manage index in array removed, using array shift instead to manage the actual test. Variable testsComplete removed, not necessary, Countdown takes care of running right amount of tests Added a test variable that has the actual code for testing Fixes: nodejs#17169
|
You are right, I did't notice that assertEqual for tests completed wasn't necessary due to the Countdown variable. |
Sorry, something went wrong.
There was a problem hiding this comment.
Changes LGTM. Thank you!
Sorry, something went wrong.
Sorry, something went wrong.
|
One test failed, could I do something about that?, or did I do something that produced that? |
Sorry, something went wrong.
|
Not your fault at all, the CI is all green as far as this PR is concerned. The failure is completely unrelated. :) |
Sorry, something went wrong.
Sorry, something went wrong.
|
awesome, thank you, I'll try to contribute more times, @apapirovski what does "closed with unmerged commits" mean? |
Sorry, something went wrong.
|
@onneri We don't use GitHub's buttons for merging, we have our own process for landing PRs so it just means that we didn't merge directly from your branch. As you'll note above, there's a reference to your commit landing on the master branch ("test: update http test to use Countdown"), listed right above my comment re: landing it. Let me know if I can provide any more info! Thanks again for helping out. Looking forward to hopefully reviewing more PRs from you in the future :) |
Sorry, something went wrong.
|
thank you again! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
The test was changed to use countdown instead of validating
if the index of the array of codes exceeded the size of the
array.
Also the validation that was before didn't allow to execute
the last test, so the assert equal was to 5, and the last
status in the array wasn't tested. The change was to
assert 6 tests complete.
Refs: #17169
Checklist
Affected core subsystem(s)