Skip to content

Commit e9d9c3f

Browse files
committed
test: add getRandomValues return length
1 parent 4830a6c commit e9d9c3f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/parallel/test-webcrypto-random.js

+8
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,11 @@ for (const ctor of intTypedConstructors) {
6969
);
7070
}
7171
}
72+
73+
{
74+
const uint8Array = new Uint8Array(32);
75+
let results = globalThis.crypto.getRandomValues(uint8Array);
76+
assert.strictEqual(results.length, uint8Array.length);
77+
results = globalThis.crypto.getRandomValues(new Uint8Array());
78+
assert.strictEqual(results.length, 0);
79+
}

0 commit comments

Comments
 (0)