Skip to content

Commit 16d3b13

Browse files
committed
test: make it possible to generate random values in tests
1 parent 98d8b40 commit 16d3b13

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

jest.env.setup.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ const crypto = require('crypto');
33

44
Object.defineProperty(globalThis, 'crypto', {
55
value: {
6-
getRandomValues: (arr) => crypto.randomBytes(arr.length),
6+
getRandomValues: (arr) => {
7+
for (let i = 0; i < arr.length; i++) {
8+
arr[i] = Math.floor(Math.random() * 256);
9+
}
10+
return arr;
11+
},
712
},
813
});

0 commit comments

Comments
 (0)