mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 21:35:34 +00:00

Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. PR-URL: https://github.com/nodejs/node/pull/10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
41 lines
821 B
JavaScript
41 lines
821 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const domain = require('domain');
|
|
const assert = require('assert');
|
|
const d = domain.create();
|
|
const expect = ['pbkdf2', 'randomBytes', 'pseudoRandomBytes'];
|
|
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
return;
|
|
}
|
|
const crypto = require('crypto');
|
|
|
|
d.on('error', common.mustCall(function(e) {
|
|
assert.strictEqual(e.message, expect.shift());
|
|
}, 3));
|
|
|
|
d.run(function() {
|
|
one();
|
|
|
|
function one() {
|
|
crypto.pbkdf2('a', 'b', 1, 8, function() {
|
|
two();
|
|
throw new Error('pbkdf2');
|
|
});
|
|
}
|
|
|
|
function two() {
|
|
crypto.randomBytes(4, function() {
|
|
three();
|
|
throw new Error('randomBytes');
|
|
});
|
|
}
|
|
|
|
function three() {
|
|
crypto.pseudoRandomBytes(4, function() {
|
|
throw new Error('pseudoRandomBytes');
|
|
});
|
|
}
|
|
});
|