Ship the Next.js cycle editor with CAD chrome, technical HX symbols, Fixed/Free boundary guidance, and secondary water/air pressure drop support in the solver stack. Co-authored-by: Cursor <cursoragent@cursor.com>
18 lines
719 B
TypeScript
18 lines
719 B
TypeScript
import "@testing-library/jest-dom/vitest";
|
|
import { afterEach } from "vitest";
|
|
import { cleanup } from "@testing-library/react";
|
|
|
|
// crypto.randomUUID is used by the diagram store; jsdom may not provide it.
|
|
const existingCrypto = (globalThis as { crypto?: Partial<Crypto> }).crypto;
|
|
if (typeof existingCrypto?.randomUUID !== "function") {
|
|
let counter = 0;
|
|
const randomUUID = (): `${string}-${string}-${string}-${string}-${string}` =>
|
|
`00000000-0000-4000-8000-${String(counter++).padStart(12, "0")}` as const;
|
|
const cryptoStub = { ...(existingCrypto ?? {}), randomUUID } as Crypto;
|
|
Object.defineProperty(globalThis, "crypto", { value: cryptoStub, configurable: true });
|
|
}
|
|
|
|
afterEach(() => {
|
|
cleanup();
|
|
});
|