Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

previewAutomationClientId.test.ts

13 lines606 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { createPreviewAutomationClientId } from "./previewAutomationClientId";
4​
5describe("createPreviewAutomationClientId", () => {
6 it("creates bounded cryptographically random identities for independent host lifetimes", () => {
7 const clientIds = Array.from({ length: 32 }, createPreviewAutomationClientId);
8​
9 expect(new Set(clientIds).size).toBe(clientIds.length);
10 expect(clientIds.every((clientId) => clientId.startsWith("preview-"))).toBe(true);
11 expect(clientIds.every((clientId) => clientId.length <= 128)).toBe(true);
12 });
13});