mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
18 lines
481 B
JavaScript
18 lines
481 B
JavaScript
import { it, expect } from "bun:test";
|
|
|
|
import crypto from "node:crypto";
|
|
|
|
it("crypto.randomBytes should return a Buffer", () => {
|
|
expect(crypto.randomBytes(1) instanceof Buffer).toBe(true);
|
|
expect(Buffer.isBuffer(crypto.randomBytes(1))).toBe(true);
|
|
});
|
|
|
|
// https://github.com/oven-sh/bun/issues/1839
|
|
it("crypto.createHash ", () => {
|
|
function fn() {
|
|
crypto.createHash("sha1").update(Math.random(), "ascii").digest("base64");
|
|
}
|
|
|
|
for (let i = 0; i < 10; i++) fn();
|
|
});
|