mirror of
https://github.com/hanzoai/calendar.git
synced 2026-09-24 22:42:24 +00:00
* Moving to vitest * Rearranging test * Fixing prettier linting * Reverting launch.json * Adjustments * Merged with main and regenerated lockfile * Fixing tests for API * Yarn updated, docs is gone --------- Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: zomars <[email protected]> Co-authored-by: Alex van Andel <[email protected]>
33 lines
814 B
TypeScript
33 lines
814 B
TypeScript
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);
|
|
});
|
|
});
|
|
});
|