test: refactor test-crypto-hash-stream-pipe

Change var to const.

PR-URL: https://github.com/nodejs/node/pull/10055
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
Matt Wilson 2016-12-01 12:07:32 -06:00 committed by Rich Trott
parent 1a83b194b3
commit c0c67c953f

View File

@ -1,17 +1,18 @@
'use strict'; 'use strict';
var common = require('../common'); const common = require('../common');
var assert = require('assert');
if (!common.hasCrypto) { if (!common.hasCrypto) {
common.skip('missing crypto'); common.skip('missing crypto');
return; return;
} }
var crypto = require('crypto');
var stream = require('stream'); const assert = require('assert');
var s = new stream.PassThrough(); const crypto = require('crypto');
var h = crypto.createHash('sha1');
var expect = '15987e60950cf22655b9323bc1e281f9c4aff47e'; const stream = require('stream');
const s = new stream.PassThrough();
const h = crypto.createHash('sha1');
const expect = '15987e60950cf22655b9323bc1e281f9c4aff47e';
s.pipe(h).on('data', common.mustCall(function(c) { s.pipe(h).on('data', common.mustCall(function(c) {
assert.strictEqual(c, expect); assert.strictEqual(c, expect);