Skip to content

Commit

Permalink
doc: replace anonymous function with arrow function
Browse files Browse the repository at this point in the history
PR-URL: #24627
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
  • Loading branch information
yuriettys authored and targos committed Nov 24, 2018
1 parent 28146d2 commit e6dd0bb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/guides/writing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ process.on('exit', function() {
assert.equal(response, 1, 'http request "response" callback was not called');
});

const server = http.createServer(function(req, res) {
const server = http.createServer((req, res) => {
request++;
res.end();
}).listen(0, function() {
const options = {
agent: null,
port: this.address().port
};
http.get(options, function(res) {
http.get(options, (res) => {
response++;
res.resume();
server.close();
Expand All @@ -191,14 +191,14 @@ This test could be greatly simplified by using `common.mustCall` like this:
const common = require('../common');
const http = require('http');

const server = http.createServer(common.mustCall(function(req, res) {
const server = http.createServer(common.mustCall((req, res) => {
res.end();
})).listen(0, function() {
const options = {
agent: null,
port: this.address().port
};
http.get(options, common.mustCall(function(res) {
http.get(options, common.mustCall((res) => {
res.resume();
server.close();
}));
Expand Down

0 comments on commit e6dd0bb

Please sign in to comment.