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

Loading…
Cancel
Save