From 81c40f0c6d381192d1ee4438789e7ffeb47ac61d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Sun, 24 May 2026 11:54:50 +0200 Subject: [PATCH] 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 --- apps/mobile/__mocks__/expo-crypto.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 apps/mobile/__mocks__/expo-crypto.ts diff --git a/apps/mobile/__mocks__/expo-crypto.ts b/apps/mobile/__mocks__/expo-crypto.ts new file mode 100644 index 0000000..2c724f2 --- /dev/null +++ b/apps/mobile/__mocks__/expo-crypto.ts @@ -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");