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>
This commit is contained in:
Ullrich Schäfer 2026-05-24 11:54:50 +02:00
parent 532b22c5c0
commit 81c40f0c6d
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9

View file

@ -0,0 +1,5 @@
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");