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 <[email protected]>
Reviewed-By: Ouyang Yadong <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
  • Loading branch information
yuriettys authored and rvagg committed Feb 28, 2019
1 parent 93ab4d2 commit 12ee805
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 12ee805

Please sign in to comment.