Skip to content

Commit 082d085

Browse files
committed
Don't monkeypatch crypto.randomBytes in tests
As far as I can tell, this... never did anything? My guess is that `crypto.randomBytes = oldRandom;` was supposed to come *after* we require()'d `serialize`, but it just didn't, so it ended up doing nothing.
1 parent df7a152 commit 082d085

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

test/unit/serialize.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,6 @@ const { deepStrictEqual, strictEqual, throws } = require('node:assert');
33

44
var serialize = require('../../');
55

6-
// temporarily monkeypatch `crypto.randomBytes` so we'll have a
7-
// predictable UID for our tests
8-
var crypto = require('crypto');
9-
var oldRandom = crypto.randomBytes;
10-
crypto.randomBytes = function(len, cb) {
11-
var buf = Buffer.alloc(len);
12-
buf.fill(0x00);
13-
if (cb)
14-
cb(null, buf);
15-
return buf;
16-
};
17-
18-
crypto.randomBytes = oldRandom;
19-
206
describe('serialize( obj )', function () {
217
it('should be a function', function () {
228
strictEqual(typeof serialize, 'function');

0 commit comments

Comments
 (0)