From 1df9340d0b460c68ac5006d881b0337fd26202fe Mon Sep 17 00:00:00 2001 From: Griffith Tchenpan Date: Sat, 17 Sep 2016 19:00:53 +1000 Subject: [PATCH] test: invoke callback with common.mustCall() * invoke callback with `common.mustCall()` in test-crypto-hash * order module declarations aphabetically per test-writing-guide PR-URL: https://github.com/nodejs/node/pull/8597 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Rich Trott --- test/parallel/test-crypto-domain.js | 2 +- test/parallel/test-crypto-hash.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-crypto-domain.js b/test/parallel/test-crypto-domain.js index d579331287c485..348b55b09d4e17 100644 --- a/test/parallel/test-crypto-domain.js +++ b/test/parallel/test-crypto-domain.js @@ -25,8 +25,8 @@ if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); -const domain = require('domain'); const crypto = require('crypto'); +const domain = require('domain'); function test(fn) { const ex = new Error('BAM'); diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js index 0cab2a9ef1e7c1..83b355a2bee181 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -4,8 +4,9 @@ if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); -const fs = require('fs'); const crypto = require('crypto'); +const fs = require('fs'); + const fixtures = require('../common/fixtures'); // Test hashing @@ -80,11 +81,11 @@ const fileStream = fs.createReadStream(fn); fileStream.on('data', function(data) { sha1Hash.update(data); }); -fileStream.on('close', function() { +fileStream.on('close', common.mustCall(function() { assert.strictEqual(sha1Hash.digest('hex'), '22723e553129a336ad96e10f6aecdf0f45e4149e', 'Test SHA1 of sample.png'); -}); +})); // Issue #2227: unknown digest method should throw an error. assert.throws(function() {