trails/apps/mobile/__mocks__/expo-crypto.ts
Ullrich Schäfer 81c40f0c6d
Add Jest mock for expo-crypto
expo-crypto@56 introduced a native AES class that throws in Jest's Node.js
environment on import. Mock the functions actually used (getRandomBytes,
digestStringAsync) so the api-client test suite can run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-24 11:54:50 +02:00

5 lines
279 B
TypeScript

export const CryptoDigestAlgorithm = { SHA256: "SHA-256" } as const;
export const CryptoEncoding = { BASE64: "base64" } as const;
export const getRandomBytes = jest.fn((size: number) => new Uint8Array(size));
export const digestStringAsync = jest.fn(async () => "mock-digest");