diff --git a/test/parallel/test-crypto-hash-stream-pipeline.js b/test/parallel/test-crypto-hash-stream-pipeline.js new file mode 100644 index 00000000000000..4e4cdcfd7fccd5 --- /dev/null +++ b/test/parallel/test-crypto-hash-stream-pipeline.js @@ -0,0 +1,21 @@ +'use strict'; + +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const assert = require('assert'); +const crypto = require('crypto'); +const stream = require('stream'); + +const hash = crypto.createHash('md5'); +const s = new stream.PassThrough(); +const expect = 'e8dc4081b13434b45189a720b77b6818'; + +s.write('abcdefgh'); +stream.pipeline(s, hash, common.mustCall(function(err) { + assert.ifError(err); + assert.strictEqual(hash.digest('hex'), expect); +})); +s.end();