mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
test:replace anonymous closure for test-http-expect-handling.js
PR-URL: https://github.com/nodejs/node/pull/24423 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
1 parent
3fadc809bb
commit
ffb5e5da4b
1 file changed
+4
-4
@@ -9,7 +9,7 @@ const tests = [417, 417];
|
||||
let testsComplete = 0;
|
||||
let testIdx = 0;
|
||||
|
||||
const s = http.createServer(function(req, res) {
|
||||
const s = http.createServer((req, res) => {
|
||||
throw new Error('this should never be executed');
|
||||
});
|
||||
|
||||
@@ -34,13 +34,13 @@ function nextTest() {
|
||||
}));
|
||||
}
|
||||
|
||||
http.get(options, function(response) {
|
||||
http.get(options, (response) => {
|
||||
console.log(`client: expected status: ${test}`);
|
||||
console.log(`client: statusCode: ${response.statusCode}`);
|
||||
assert.strictEqual(response.statusCode, test);
|
||||
assert.strictEqual(response.statusMessage, 'Expectation Failed');
|
||||
|
||||
response.on('end', function() {
|
||||
response.on('end', () => {
|
||||
testsComplete++;
|
||||
testIdx++;
|
||||
nextTest();
|
||||
@@ -50,6 +50,6 @@ function nextTest() {
|
||||
}
|
||||
|
||||
|
||||
process.on('exit', function() {
|
||||
process.on('exit', () => {
|
||||
assert.strictEqual(testsComplete, 2);
|
||||
});
|
||||
Reference in new issue
Block a user