Skip to content

Commit

Permalink
test: refactor test-http-dns-error
Browse files Browse the repository at this point in the history
Replace var with const and use strictEqual().

PR-URL: #10062
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
  • Loading branch information
outsideris authored and MylesBorins committed Dec 20, 2016
1 parent 00f0864 commit bcbf50d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/parallel/test-http-dns-error.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
'use strict';
var common = require('../common');
var assert = require('assert');
const common = require('../common');
const assert = require('assert');

var http = require('http');
const http = require('http');

if (common.hasCrypto) {
var https = require('https');
} else {
common.skip('missing crypto');
}

var host = '*'.repeat(256);
const host = '*'.repeat(256);

function do_not_call() {
throw new Error('This function should not have been called.');
Expand All @@ -20,15 +20,15 @@ function test(mod) {

// Bad host name should not throw an uncatchable exception.
// Ensure that there is time to attach an error listener.
var req1 = mod.get({host: host, port: 42}, do_not_call);
const req1 = mod.get({host: host, port: 42}, do_not_call);
req1.on('error', common.mustCall(function(err) {
assert.equal(err.code, 'ENOTFOUND');
assert.strictEqual(err.code, 'ENOTFOUND');
}));
// http.get() called req1.end() for us

var req2 = mod.request({method: 'GET', host: host, port: 42}, do_not_call);
const req2 = mod.request({method: 'GET', host: host, port: 42}, do_not_call);
req2.on('error', common.mustCall(function(err) {
assert.equal(err.code, 'ENOTFOUND');
assert.strictEqual(err.code, 'ENOTFOUND');
}));
req2.end();
}
Expand Down

0 comments on commit bcbf50d

Please sign in to comment.