Skip to content

Commit

Permalink
test: add getRandomValues return length
Browse files Browse the repository at this point in the history
  • Loading branch information
MrJithil committed Jan 26, 2023
1 parent 4830a6c commit e088f32
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/parallel/test-webcrypto-random.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,11 @@ for (const ctor of intTypedConstructors) {
);
}
}

{
const uint8Array = new Uint8Array(32)
let results = globalThis.crypto.getRandomValues(uint8Array);
assert.strictEqual(results.length, uint8Array.length);
results = globalThis.crypto.getRandomValues(new Uint8Array());
assert.strictEqual(results.length, 0);
}

0 comments on commit e088f32

Please sign in to comment.