Skip to content

Commit

Permalink
test: invoke callback with common.mustCall()
Browse files Browse the repository at this point in the history
* invoke callback with `common.mustCall()` in test-crypto-hash
* order module declarations aphabetically per test-writing-guide

PR-URL: nodejs#8597
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
Griffith Tchenpan authored and Trott committed Aug 13, 2017
1 parent a7189c0 commit 1df9340
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/parallel/test-crypto-domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
7 changes: 4 additions & 3 deletions test/parallel/test-crypto-hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 1df9340

Please sign in to comment.