@rnw-community/react-native-payments 0.75.0 → 0.75.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +4 -3
  2. package/readme.md +26 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnw-community/react-native-payments",
3
- "version": "0.75.0",
3
+ "version": "0.75.3",
4
4
  "description": "React Native Payments",
5
5
  "keywords": [
6
6
  "react",
@@ -28,7 +28,8 @@
28
28
  ".": {
29
29
  "import": "./dist/esm/index.js",
30
30
  "require": "./dist/cjs/index.js"
31
- }
31
+ },
32
+ "./package.json": "./package.json"
32
33
  },
33
34
  "react-native": "src/index.ts",
34
35
  "main": "dist/cjs/index.js",
@@ -73,7 +74,7 @@
73
74
  "build:android": "cd example/android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
74
75
  "build:ios": "cd example/ios && xcodebuild -workspace PaymentsExample.xcworkspace -scheme PaymentsExample -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO"
75
76
  },
76
- "gitHead": "89b514d7f31bdec964a7ac1a91db2f93f08fcf7f",
77
+ "gitHead": "5c982120abec2c117a3f4db143cc8b9204faedf7",
77
78
  "dependencies": {
78
79
  "@rnw-community/shared": "0.75.0",
79
80
  "react-native-uuid": "^2.0.1",
package/readme.md CHANGED
@@ -248,6 +248,32 @@ payment process or when specific conditions require the payment request to be ab
248
248
 
249
249
  > This will have no affect in the Android platform due to AndroidPay implementation.
250
250
 
251
+
252
+ ## Unit testing
253
+ Due to new TurboModules architecture in React Native, you can [encounter issues](https://github.com/rnw-community/rnw-community/issues/227) with Jest tests. To fix this, you can mock
254
+ the TurboModuleRegistry to disable the `Payment` module in Jest tests. Here is an example of how you can do this:
255
+
256
+ ```ts
257
+ const turboModuleRegistry = jest.requireActual(
258
+ 'react-native/Libraries/TurboModule/TurboModuleRegistry'
259
+ );
260
+
261
+ /** HINT: Mock TurboModuleRegistry to disable the `Payment` module in Jest tests */
262
+ export function setupJestTurboModuleMock(): void {
263
+ jest.mock('react-native/Libraries/TurboModule/TurboModuleRegistry', () => {
264
+ return {
265
+ ...turboModuleRegistry,
266
+ getEnforcing: (name: string) => {
267
+ if (name === 'Payment') {
268
+ return null; // Return null to mock the Payment module
269
+ }
270
+ return turboModuleRegistry.getEnforcing(name);
271
+ },
272
+ };
273
+ });
274
+ }
275
+ ```
276
+
251
277
  ## Example
252
278
 
253
279
  You can find working example in the `App` component of