diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/unit_node/crypto/crypto_hash_test.ts | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/cli/tests/unit_node/crypto/crypto_hash_test.ts b/cli/tests/unit_node/crypto/crypto_hash_test.ts index e140765ec..4b0aedf03 100644 --- a/cli/tests/unit_node/crypto/crypto_hash_test.ts +++ b/cli/tests/unit_node/crypto/crypto_hash_test.ts @@ -1,5 +1,11 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -import { createHash, createHmac, getHashes, randomUUID } from "node:crypto"; +import { + createHash, + createHmac, + getHashes, + randomFillSync, + randomUUID, +} from "node:crypto"; import { Buffer } from "node:buffer"; import { Readable } from "node:stream"; import { @@ -124,3 +130,13 @@ Deno.test("[node/crypto.getRandomUUID] works the same way as Web Crypto API", () assertEquals(randomUUID().length, crypto.randomUUID().length); assertEquals(typeof randomUUID(), typeof crypto.randomUUID()); }); + +Deno.test("[node/crypto.randomFillSync] supported arguments", () => { + const buf = new Uint8Array(10); + + assert(randomFillSync(buf)); + assert(randomFillSync(buf, 0)); + // @ts-ignore: arraybuffer arguments are valid. + assert(randomFillSync(buf.buffer)); + assert(randomFillSync(new DataView(buf.buffer))); +}); |