From 2e36b2ef496affe82a6756e265f3ba773ea00248 Mon Sep 17 00:00:00 2001 From: Fabrice Tatieze Date: Thu, 1 Dec 2016 10:21:41 -0600 Subject: [PATCH] test: using const and strictEqual PR-URL: https://github.com/nodejs/node/pull/9926 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-console-instance.js | 10 +++++----- test/parallel/test-dgram-msgsize.js | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/test/parallel/test-console-instance.js b/test/parallel/test-console-instance.js index b8d9880865530b..4d2727d96b1a55 100644 --- a/test/parallel/test-console-instance.js +++ b/test/parallel/test-console-instance.js @@ -15,7 +15,7 @@ process.stdout.write = process.stderr.write = function() { }; // make sure that the "Console" function exists -assert.equal('function', typeof Console); +assert.strictEqual('function', typeof Console); // make sure that the Console constructor throws // when not given a writable stream instance @@ -35,7 +35,7 @@ out.write = err.write = function(d) {}; var c = new Console(out, err); out.write = err.write = function(d) { - assert.equal(d, 'test\n'); + assert.strictEqual(d, 'test\n'); called = true; }; @@ -48,7 +48,7 @@ c.error('test'); assert(called); out.write = function(d) { - assert.equal('{ foo: 1 }\n', d); + assert.strictEqual('{ foo: 1 }\n', d); called = true; }; @@ -60,10 +60,10 @@ assert(called); called = 0; out.write = function(d) { called++; - assert.equal(d, called + ' ' + (called - 1) + ' [ 1, 2, 3 ]\n'); + assert.strictEqual(d, called + ' ' + (called - 1) + ' [ 1, 2, 3 ]\n'); }; [1, 2, 3].forEach(c.log); -assert.equal(3, called); +assert.strictEqual(3, called); // Console() detects if it is called without `new` keyword assert.doesNotThrow(function() { diff --git a/test/parallel/test-dgram-msgsize.js b/test/parallel/test-dgram-msgsize.js index ec4021b99fd899..6cc415e83c00ca 100644 --- a/test/parallel/test-dgram-msgsize.js +++ b/test/parallel/test-dgram-msgsize.js @@ -1,18 +1,18 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var dgram = require('dgram'); +const common = require('../common'); +const assert = require('assert'); +const dgram = require('dgram'); // Send a too big datagram. The destination doesn't matter because it's // not supposed to get sent out anyway. -var buf = Buffer.allocUnsafe(256 * 1024); -var sock = dgram.createSocket('udp4'); +const buf = Buffer.allocUnsafe(256 * 1024); +const sock = dgram.createSocket('udp4'); sock.send(buf, 0, buf.length, 12345, '127.0.0.1', common.mustCall(cb)); function cb(err) { assert(err instanceof Error); - assert.equal(err.code, 'EMSGSIZE'); - assert.equal(err.address, '127.0.0.1'); - assert.equal(err.port, 12345); - assert.equal(err.message, 'send EMSGSIZE 127.0.0.1:12345'); + assert.strictEqual(err.code, 'EMSGSIZE'); + assert.strictEqual(err.address, '127.0.0.1'); + assert.strictEqual(err.port, 12345); + assert.strictEqual(err.message, 'send EMSGSIZE 127.0.0.1:12345'); sock.close(); }