Browse Source

test: update test-tls-check-server-identity.js

Changed var to const, assert.equal to assert.strictEqual, and
used a template string for error output.

PR-URL: https://github.com/nodejs/node/pull/9986
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6
Kevin Cox 8 years ago
committed by Rich Trott
parent
commit
b00f8ad13a
  1. 21
      test/parallel/test-tls-check-server-identity.js

21
test/parallel/test-tls-check-server-identity.js

@ -1,16 +1,17 @@
'use strict'; 'use strict';
var common = require('../common'); const common = require('../common');
var assert = require('assert');
var util = require('util');
if (!common.hasCrypto) { if (!common.hasCrypto) {
common.skip('missing crypto'); common.skip('missing crypto');
return; return;
} }
var tls = require('tls');
const assert = require('assert');
const util = require('util');
var tests = [ const tls = require('tls');
const tests = [
// False-y values. // False-y values.
{ {
host: false, host: false,
@ -253,9 +254,9 @@ var tests = [
]; ];
tests.forEach(function(test, i) { tests.forEach(function(test, i) {
var err = tls.checkServerIdentity(test.host, test.cert); const err = tls.checkServerIdentity(test.host, test.cert);
assert.equal(err && err.reason, assert.strictEqual(err && err.reason,
test.error, test.error,
'Test#' + i + ' failed: ' + util.inspect(test) + '\n' + `Test# ${i} failed: ${util.inspect(test)} \n` +
test.error + ' != ' + (err && err.reason)); `${test.error} != ${(err && err.reason)}`);
}); });

Loading…
Cancel
Save