diff --git a/examples/react-native/__mocks__/expo-crypto.js b/examples/react-native/__mocks__/expo-crypto.js new file mode 100644 index 00000000000..e9e5d2759d1 --- /dev/null +++ b/examples/react-native/__mocks__/expo-crypto.js @@ -0,0 +1,5 @@ +module.exports = { + digest: async (_algorithm, _data) => new Uint8Array(32), + getRandomValues: (arr) => arr, + randomUUID: () => 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx', +}; diff --git a/examples/react-native/jest.config.js b/examples/react-native/jest.config.js index 6b759c8090f..1f6c03b0d18 100644 --- a/examples/react-native/jest.config.js +++ b/examples/react-native/jest.config.js @@ -3,17 +3,11 @@ const transformIgnorePatterns = [ ]; module.exports = { - projects: [ - { - preset: "jest-expo/ios", - transformIgnorePatterns, - }, - { - preset: "jest-expo/android", - transformIgnorePatterns, - }, - ], - + preset: "@react-native/jest-preset", + transformIgnorePatterns, testRegex: "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", + moduleNameMapper: { + '^expo-crypto$': '/__mocks__/expo-crypto.js', + }, }; \ No newline at end of file diff --git a/examples/react-native/package.json b/examples/react-native/package.json index fbe7c427cc3..0687816dfac 100644 --- a/examples/react-native/package.json +++ b/examples/react-native/package.json @@ -15,6 +15,7 @@ "devDependencies": { "@babel/core": "7.29.0", "@expo/cli": "55.0.28", + "@react-native/jest-preset": "0.85.3", "babel-preset-expo": "54.0.9", "buffer": "6.0.3", "cross-fetch": "4.1.0", @@ -25,7 +26,7 @@ "jest-expo": "54.0.16", "random-token": "0.0.8", "react": "19.2.5", - "react-native": "0.84.1", + "react-native": "0.85.3", "react-native-gesture-handler": "2.31.1", "react-native-get-random-values": "2.0.0", "react-native-quick-base64": "2.2.2",