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 rvagg committed Nov 28, 2018
1 parent 1067653 commit f80e7a1
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 f80e7a1

Please sign in to comment.