2
0

first commit

This commit is contained in:
2024-08-09 00:39:27 +02:00
commit 79688abe2e
5698 changed files with 497838 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import { describe, expect, it } from "vitest";
import { randomString } from "./random";
describe("Random util tests", () => {
describe("fn: randomString", () => {
it("should return a random string of a given length", () => {
const length = 10;
const result = randomString(length);
expect(result).toHaveLength(length);
});
it("should return a random string of a default length", () => {
const length = 12;
const result = randomString();
expect(result).toHaveLength(length);
});
it("should return a random string of a given length using alphanumeric characters", () => {
const length = 10;
const result = randomString(length);
expect(result).toMatch(/^[a-zA-Z0-9]+$/);
expect(result).toHaveLength(length);
});
});
});