Browse Source

test: refactor test-http-hostname-typechecking

* Use common.mustCall() to confirm callback is invoked.
* Change spacing of require statements to conform to test-writing guide.

PR-URL: https://github.com/nodejs/node/pull/13993
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
v6
Rich Trott 8 years ago
parent
commit
5bbae25177
  1. 6
      test/parallel/test-http-hostname-typechecking.js

6
test/parallel/test-http-hostname-typechecking.js

@ -1,6 +1,6 @@
'use strict'; 'use strict';
const common = require('../common'); const common = require('../common');
const assert = require('assert'); const assert = require('assert');
const http = require('http'); const http = require('http');
@ -21,7 +21,7 @@ vals.forEach((v) => {
// These values are OK and should not throw synchronously // These values are OK and should not throw synchronously
['', undefined, null].forEach((v) => { ['', undefined, null].forEach((v) => {
assert.doesNotThrow(() => { assert.doesNotThrow(() => {
http.request({hostname: v}).on('error', common.noop).end(); http.request({hostname: v}).on('error', common.mustCall()).end();
http.request({host: v}).on('error', common.noop).end(); http.request({host: v}).on('error', common.mustCall()).end();
}); });
}); });

Loading…
Cancel
Save