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:
parent
532b22c5c0
commit
81c40f0c6d
1 changed files with 5 additions and 0 deletions
5
apps/mobile/__mocks__/expo-crypto.ts
Normal file
5
apps/mobile/__mocks__/expo-crypto.ts
Normal 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");
|
||||
Loading…
Add table
Add a link
Reference in a new issue