Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
doc: use arrow functions in writing-tests.md
  • Loading branch information
GaryGSC committed Oct 25, 2019
commit d2bb4862d20d581f6f5511e1ebc3f9a1c821fbf6
12 changes: 6 additions & 6 deletions doc/guides/writing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,18 @@ const http = require('http');

let request = 0;
let response = 0;
process.on('exit', function() {
process.on('exit', () => {
assert.equal(request, 1, 'http server "request" callback was not called');
assert.equal(response, 1, 'http request "response" callback was not called');
});

const server = http.createServer((req, res) => {
request++;
res.end();
}).listen(0, function() {
}).listen(0, () => {
const options = {
agent: null,
port: this.address().port
port: server.address().port
};
http.get(options, (res) => {
response++;
Expand All @@ -193,10 +193,10 @@ const http = require('http');

const server = http.createServer(common.mustCall((req, res) => {
res.end();
})).listen(0, function() {
})).listen(0, () => {
const options = {
agent: null,
port: this.address().port
port: server.address().port
};
http.get(options, common.mustCall((res) => {
res.resume();
Expand All @@ -216,7 +216,7 @@ shutting down an HTTP server after a specific number of requests).
```javascript
const Countdown = require('../common/countdown');

const countdown = new Countdown(2, function() {
const countdown = new Countdown(2, () => {
console.log('.');
});

Expand Down