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:
parent
f25123822e
commit
1dadaf90f6
@ -9,7 +9,7 @@ const tests = [417, 417];
|
|||||||
let testsComplete = 0;
|
let testsComplete = 0;
|
||||||
let testIdx = 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');
|
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: expected status: ${test}`);
|
||||||
console.log(`client: statusCode: ${response.statusCode}`);
|
console.log(`client: statusCode: ${response.statusCode}`);
|
||||||
assert.strictEqual(response.statusCode, test);
|
assert.strictEqual(response.statusCode, test);
|
||||||
assert.strictEqual(response.statusMessage, 'Expectation Failed');
|
assert.strictEqual(response.statusMessage, 'Expectation Failed');
|
||||||
|
|
||||||
response.on('end', function() {
|
response.on('end', () => {
|
||||||
testsComplete++;
|
testsComplete++;
|
||||||
testIdx++;
|
testIdx++;
|
||||||
nextTest();
|
nextTest();
|
||||||
@ -50,6 +50,6 @@ function nextTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
process.on('exit', function() {
|
process.on('exit', () => {
|
||||||
assert.strictEqual(testsComplete, 2);
|
assert.strictEqual(testsComplete, 2);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user