Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: add test that verifies crypto stream pipeline
This test fails prior to 990feaf being cherry-picked
due to stream.pipeline with a crypto.Hash not working properly.

That bug also seems to have affected md5.

PR-URL: #37009
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
  • Loading branch information
evanlucas authored and richardlau committed Feb 8, 2021
commit 1c6fbd6ffe7eb10053be3cfb84dc4ae11b4d94c3
21 changes: 21 additions & 0 deletions test/parallel/test-crypto-hash-stream-pipeline.js
Original file line number Diff line number Diff line change
@@ -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();