@react-native-firebase/app 26.4.0 → 27.1.0
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.
- package/CHANGELOG.md +62 -0
- package/README.md +10 -27
- package/RNFBApp.podspec +13 -5
- package/android/build.gradle +3 -0
- package/android/src/main/java/io/invertase/firebase/common/RNFBHandleCollisionException.kt +29 -0
- package/android/src/main/java/io/invertase/firebase/common/RNFBHandleMap.kt +146 -0
- package/android/src/main/java/io/invertase/firebase/common/TaskExecutorService.kt +156 -0
- package/android/src/main/java/io/invertase/firebase/common/UniversalFirebaseModule.kt +44 -0
- package/android/src/main/java/io/invertase/firebase/common/UniversalFirebasePreferences.kt +100 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/NativeRNFBTurboApp.kt +250 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseApp.kt +64 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/{ReactNativeFirebaseAppInitProvider.java → ReactNativeFirebaseAppInitProvider.kt} +3 -4
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppPackage.kt +47 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppRegistrar.kt +33 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseVersion.java +1 -1
- package/android/src/reactnative/java/io/invertase/firebase/common/RCTConvertFirebase.kt +185 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEvent.kt +35 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitter.kt +662 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseJSON.kt +103 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseMeta.kt +96 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseModule.kt +140 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebasePreferences.kt +109 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/SharedUtils.kt +451 -0
- package/android/src/reactnative/java/io/invertase/firebase/interfaces/{ContextProvider.java → ContextProvider.kt} +8 -8
- package/android/src/reactnative/java/io/invertase/firebase/interfaces/{NativeError.java → NativeError.kt} +8 -8
- package/android/src/reactnative/java/io/invertase/firebase/interfaces/{NativeEvent.java → NativeEvent.kt} +6 -6
- package/android/src/reactnative/java/io/invertase/firebase/utils/NativeRNFBTurboUtils.kt +219 -0
- package/android/src/test/java/expo/core/ModuleRegistry.java +9 -0
- package/android/src/test/java/io/invertase/firebase/app/NativeRNFBTurboAppTest.java +182 -59
- package/android/src/test/java/io/invertase/firebase/app/ReactNativeFirebaseAppComponentsJavaCompatibilityTest.java +70 -0
- package/android/src/test/java/io/invertase/firebase/app/ReactNativeFirebaseAppJavaCompatibilityTest.java +60 -0
- package/android/src/test/java/io/invertase/firebase/app/ReactNativeFirebaseAppPackageTest.java +165 -0
- package/android/src/test/java/io/invertase/firebase/app/ReactNativeFirebaseAppTest.kt +167 -0
- package/android/src/test/java/io/invertase/firebase/common/RCTConvertFirebaseJavaCompatibilityTest.java +112 -0
- package/android/src/test/java/io/invertase/firebase/common/RCTConvertFirebaseTest.kt +317 -0
- package/android/src/test/java/io/invertase/firebase/common/RNFBHandleMapTest.kt +309 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitterJavaCompatibilityTest.java +176 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitterTest.java +143 -12
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseEventTest.kt +61 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseJSONJavaCompatibilityTest.java +85 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseJSONTest.kt +296 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseMetaJavaCompatibilityTest.java +67 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseMetaTest.kt +246 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseModuleTest.kt +254 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebasePreferencesJavaCompatibilityTest.java +87 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebasePreferencesTest.kt +260 -0
- package/android/src/test/java/io/invertase/firebase/common/SharedUtilsJavaCompatibilityTest.java +255 -0
- package/android/src/test/java/io/invertase/firebase/common/SharedUtilsTest.kt +674 -0
- package/android/src/test/java/io/invertase/firebase/common/TaskExecutorServiceTest.kt +290 -0
- package/android/src/test/java/io/invertase/firebase/common/UniversalFirebaseModuleJavaCompatibilityTest.java +178 -0
- package/android/src/test/java/io/invertase/firebase/common/UniversalFirebasePreferencesJavaCompatibilityTest.java +99 -0
- package/android/src/test/java/io/invertase/firebase/common/UniversalFirebasePreferencesTest.kt +217 -0
- package/android/src/test/java/io/invertase/firebase/commoncompat/ReactNativeFirebaseModuleJavaCompatibilityTest.java +176 -0
- package/android/src/test/java/io/invertase/firebase/commoncompat/ReactNativeFirebaseModuleKotlinCompatibilityTest.kt +52 -0
- package/android/src/test/java/io/invertase/firebase/interfaces/InterfacesJavaCompatibilityTest.java +144 -0
- package/android/src/test/java/io/invertase/firebase/interfaces/NativeEventTest.kt +56 -0
- package/android/src/test/java/io/invertase/firebase/utils/NativeRNFBTurboUtilsTest.java +517 -21
- package/dist/module/FirebaseApp.js +10 -0
- package/dist/module/FirebaseApp.js.map +1 -1
- package/dist/module/common/deeps.js +3 -0
- package/dist/module/common/deeps.js.map +1 -1
- package/dist/module/internal/FirebaseModule.js.map +1 -1
- package/dist/module/internal/RNFBNativeEventEmitter.js +12 -1
- package/dist/module/internal/RNFBNativeEventEmitter.js.map +1 -1
- package/dist/module/internal/SharedEventEmitter.js +3 -1
- package/dist/module/internal/SharedEventEmitter.js.map +1 -1
- package/dist/module/internal/index.js +1 -0
- package/dist/module/internal/index.js.map +1 -1
- package/dist/module/internal/registry/app.js +7 -1
- package/dist/module/internal/registry/app.js.map +1 -1
- package/dist/module/types/app.js.map +1 -1
- package/dist/module/types/internal.js +2 -0
- package/dist/module/version.js +1 -1
- package/dist/typescript/lib/FirebaseApp.d.ts +7 -0
- package/dist/typescript/lib/FirebaseApp.d.ts.map +1 -1
- package/dist/typescript/lib/common/deeps.d.ts.map +1 -1
- package/dist/typescript/lib/internal/FirebaseModule.d.ts +2 -3
- package/dist/typescript/lib/internal/FirebaseModule.d.ts.map +1 -1
- package/dist/typescript/lib/internal/NativeModules.d.ts +4 -1
- package/dist/typescript/lib/internal/NativeModules.d.ts.map +1 -1
- package/dist/typescript/lib/internal/RNFBNativeEventEmitter.d.ts +2 -2
- package/dist/typescript/lib/internal/RNFBNativeEventEmitter.d.ts.map +1 -1
- package/dist/typescript/lib/internal/SharedEventEmitter.d.ts +3 -3
- package/dist/typescript/lib/internal/SharedEventEmitter.d.ts.map +1 -1
- package/dist/typescript/lib/internal/index.d.ts +1 -0
- package/dist/typescript/lib/internal/index.d.ts.map +1 -1
- package/dist/typescript/lib/internal/registry/app.d.ts.map +1 -1
- package/dist/typescript/lib/types/app.d.ts +10 -3
- package/dist/typescript/lib/types/app.d.ts.map +1 -1
- package/dist/typescript/lib/types/internal.d.ts +12 -0
- package/dist/typescript/lib/types/internal.d.ts.map +1 -1
- package/dist/typescript/lib/version.d.ts +1 -1
- package/firebase-schema.json +4 -0
- package/firebase_spm.rb +552 -96
- package/ios/RNFBApp/RCTConvert+FIRApp.h +2 -5
- package/ios/RNFBApp/RCTConvert+FIRApp.m +11 -6
- package/ios/RNFBApp/RCTConvert+FIROptions.h +2 -5
- package/ios/RNFBApp/RCTConvert+FIROptions.m +11 -10
- package/ios/RNFBApp/RCTConvertFIRApp.swift +86 -0
- package/ios/RNFBApp/RCTConvertFIROptions.swift +259 -0
- package/ios/RNFBApp/RNFBAppCustomAuthDomains.swift +63 -0
- package/ios/RNFBApp/RNFBAppInitializeOptionsMapper.swift +113 -0
- package/ios/RNFBApp/RNFBAppLogLevelMapper.swift +53 -0
- package/ios/RNFBApp/RNFBAppModule+CustomAuthDomain.m +35 -0
- package/ios/RNFBApp/RNFBAppModule.h +6 -2
- package/ios/RNFBApp/RNFBAppModule.mm +65 -228
- package/ios/RNFBApp/RNFBAppModuleFirebase.swift +439 -0
- package/ios/RNFBApp/RNFBAppModuleImplementation.h +68 -0
- package/ios/RNFBApp/RNFBAppModuleImplementation.m +195 -0
- package/ios/RNFBApp/RNFBHandleMap.m +27 -56
- package/ios/RNFBApp/RNFBHandleMapStorage.swift +90 -0
- package/ios/RNFBApp/RNFBInitializeAppArguments.swift +82 -0
- package/ios/RNFBApp/RNFBJSON.m +22 -38
- package/ios/RNFBApp/RNFBJSONImplementation.swift +71 -0
- package/ios/RNFBApp/RNFBMeta.m +24 -26
- package/ios/RNFBApp/RNFBMetaStorage.swift +76 -0
- package/ios/RNFBApp/RNFBNullSentinelDecoding.swift +135 -0
- package/ios/RNFBApp/RNFBNullSentinelInterceptor.h +30 -3
- package/ios/RNFBApp/RNFBNullSentinelInterceptor.m +28 -5
- package/ios/RNFBApp/RNFBPreferences.m +22 -20
- package/ios/RNFBApp/RNFBPreferencesStorage.swift +101 -0
- package/ios/RNFBApp/RNFBRCTEventEmitter.m +36 -93
- package/ios/RNFBApp/RNFBRCTEventEmitterCore.swift +161 -0
- package/ios/RNFBApp/RNFBSharedUtils.h +2 -5
- package/ios/RNFBApp/RNFBSharedUtils.m +109 -198
- package/ios/RNFBApp/RNFBSharedUtilsConfig.swift +72 -0
- package/ios/RNFBApp/RNFBSharedUtilsFIRApp.swift +271 -0
- package/ios/RNFBApp/RNFBSharedUtilsFormatting.swift +59 -0
- package/ios/RNFBApp/RNFBSharedUtilsPromiseRejection.swift +88 -0
- package/ios/RNFBApp/RNFBUtilsHelpers.swift +116 -0
- package/ios/RNFBApp/RNFBUtilsModule+Foundation.m +44 -0
- package/ios/RNFBApp/RNFBUtilsModule+PhotoAssets.m +47 -0
- package/ios/RNFBApp/RNFBUtilsModule.h +11 -1
- package/ios/RNFBApp/RNFBUtilsModule.mm +10 -85
- package/ios/RNFBApp/RNFBUtilsModuleImplementation.h +32 -0
- package/ios/RNFBApp/RNFBUtilsModuleImplementation.m +56 -0
- package/ios/RNFBApp/RNFBVersion.m +1 -1
- package/ios/RNFBApp.xcodeproj/project.pbxproj +100 -0
- package/ios/RNFBAppUnitTests/HostStubs/FirebaseCore/FIRApp.m +171 -0
- package/ios/RNFBAppUnitTests/HostStubs/FirebaseCore/FirebaseCore.h +78 -0
- package/ios/RNFBAppUnitTests/HostStubs/FirebaseInstallations/FIRInstallations.m +7 -0
- package/ios/RNFBAppUnitTests/HostStubs/FirebaseInstallations/FirebaseInstallations.h +8 -0
- package/ios/RNFBAppUnitTests/HostStubs/RNFBAppModuleHostStub.m +55 -0
- package/ios/RNFBAppUnitTests/HostStubs/RNFBAppTurboModules.h +89 -0
- package/ios/RNFBAppUnitTests/HostStubs/RNFBAppTurboModules.mm +30 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTBridge.h +19 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTBridge.m +32 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTBridgeModule.h +19 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTConvert.h +28 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTConvert.m +23 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTEventEmitter.h +9 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTInvalidating.h +24 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTUtils.h +9 -0
- package/ios/RNFBAppUnitTests/HostStubs/module.modulemap +13 -0
- package/ios/RNFBAppUnitTests/RCTConvertFIRAppFacadeTests.m +61 -0
- package/ios/RNFBAppUnitTests/RCTConvertFIRAppTests.swift +73 -0
- package/ios/RNFBAppUnitTests/RCTConvertFIROptionsFacadeTests.m +57 -0
- package/ios/RNFBAppUnitTests/RCTConvertFIROptionsTests.swift +243 -0
- package/ios/RNFBAppUnitTests/RNFBAppCustomAuthDomainsFacadeTests.m +73 -0
- package/ios/RNFBAppUnitTests/RNFBAppCustomAuthDomainsTests.swift +70 -0
- package/ios/RNFBAppUnitTests/RNFBAppInitializeOptionsMapperTests.swift +190 -0
- package/ios/RNFBAppUnitTests/RNFBAppLogLevelFacadeTests.m +76 -0
- package/ios/RNFBAppUnitTests/RNFBAppLogLevelMapperTests.swift +59 -0
- package/ios/RNFBAppUnitTests/RNFBAppModuleFirebaseFacadeTests.m +215 -0
- package/ios/RNFBAppUnitTests/RNFBAppModuleFirebaseTests.swift +430 -0
- package/ios/RNFBAppUnitTests/RNFBAppModuleLifecycleTests.m +206 -0
- package/ios/RNFBAppUnitTests/RNFBAppModuleShellTests.mm +367 -0
- package/ios/RNFBAppUnitTests/RNFBAppUnitTests.xcodeproj/project.pbxproj +355 -2
- package/ios/RNFBAppUnitTests/RNFBFirebaseAppClientTests.swift +165 -0
- package/ios/RNFBAppUnitTests/RNFBHandleMapStorageTests.swift +121 -0
- package/ios/RNFBAppUnitTests/RNFBInitializeAppArgumentsTests.swift +256 -0
- package/ios/RNFBAppUnitTests/RNFBJSONImplementationTests.swift +126 -0
- package/ios/RNFBAppUnitTests/RNFBJSONTests.m +172 -0
- package/ios/RNFBAppUnitTests/RNFBMetaStorageTests.swift +106 -0
- package/ios/RNFBAppUnitTests/RNFBMetaTests.m +65 -0
- package/ios/RNFBAppUnitTests/RNFBNullSentinelDecodingTests.swift +286 -0
- package/ios/RNFBAppUnitTests/RNFBNullSentinelInterceptorTests.m +312 -0
- package/ios/RNFBAppUnitTests/RNFBPreferencesStorageTests.swift +105 -0
- package/ios/RNFBAppUnitTests/RNFBPreferencesTests.m +110 -0
- package/ios/RNFBAppUnitTests/RNFBRCTEventEmitterCoreTests.swift +163 -0
- package/ios/RNFBAppUnitTests/RNFBRCTEventEmitterFacadeTests.m +141 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsConfigFacadeTests.m +100 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsConfigTests.swift +234 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsFIRAppFacadeTests.m +145 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsFIRAppTests.swift +173 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsFormattingFacadeTests.m +38 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsFormattingTests.swift +82 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsNullSentinelTests.m +35 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsPromiseRejectionFacadeTests.m +107 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsPromiseRejectionTests.swift +133 -0
- package/ios/RNFBAppUnitTests/RNFBUtilsHelpersTests.swift +144 -0
- package/ios/RNFBAppUnitTests/RNFBUtilsModuleFacadeTests.m +72 -0
- package/ios/RNFBAppUnitTests/RNFBUtilsModuleShellTests.mm +282 -0
- package/ios/RNFBFirebase/Package.swift +53 -0
- package/ios/RNFBFirebase/Sources/RNFBFirebase/RNFBFirebase.swift +285 -0
- package/ios/RNFBFirebase/Sources/RNFBFirebaseBridge/Public/.gitkeep +0 -0
- package/ios/RNFBFirebase/Sources/RNFBFirebaseBridge/RNFBFirebaseBridge.m +169 -0
- package/ios/RNFBFirebase/Sources/RNFBFirebaseBridge/include/RNFBFirebaseBridge.h +52 -0
- package/ios/RNFBFirebaseUnitTests/RNFBAppDynamicFacadeTests.swift +240 -0
- package/{android/src/main/java/io/invertase/firebase/common/RNFBHandleCollisionException.java → ios/RNFBFirebaseUnitTests/RNFBFirebaseClientImport.swift} +23 -14
- package/ios/RNFBFirebaseUnitTests/RNFBFirebaseUnitTests.xcodeproj/project.pbxproj +588 -0
- package/ios/RNFBFirebaseUnitTests/RNFBFirebaseUnitTests.xcodeproj/xcshareddata/xcschemes/RNFBFirebaseUnitTests.xcscheme +83 -0
- package/ios_config.sh +50 -22
- package/lib/FirebaseApp.ts +10 -0
- package/lib/common/deeps.ts +3 -0
- package/lib/internal/FirebaseModule.ts +6 -3
- package/lib/internal/NativeModules.ts +4 -1
- package/lib/internal/RNFBNativeEventEmitter.ts +14 -5
- package/lib/internal/SharedEventEmitter.ts +5 -1
- package/lib/internal/index.ts +1 -0
- package/lib/internal/react-native-vendor-emitter.d.ts +11 -0
- package/lib/internal/registry/app.ts +7 -1
- package/lib/types/app.ts +10 -3
- package/lib/types/internal.ts +19 -0
- package/lib/version.ts +1 -1
- package/package.json +8 -8
- package/plugin/build/ios/appDelegate.js +2 -2
- package/plugin/build/ios/podfile.js +16 -16
- package/plugin/build/pluginConfig.d.ts +4 -2
- package/plugin/src/ios/appDelegate.ts +2 -2
- package/plugin/src/ios/podfile.ts +20 -23
- package/plugin/src/pluginConfig.ts +4 -2
- package/android/src/main/java/io/invertase/firebase/common/RNFBHandleMap.java +0 -150
- package/android/src/main/java/io/invertase/firebase/common/TaskExecutorService.java +0 -148
- package/android/src/main/java/io/invertase/firebase/common/UniversalFirebaseModule.java +0 -62
- package/android/src/main/java/io/invertase/firebase/common/UniversalFirebasePreferences.java +0 -91
- package/android/src/reactnative/java/io/invertase/firebase/app/NativeRNFBTurboApp.java +0 -224
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseApp.java +0 -46
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppPackage.java +0 -49
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppRegistrar.java +0 -35
- package/android/src/reactnative/java/io/invertase/firebase/common/RCTConvertFirebase.java +0 -192
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEvent.java +0 -53
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitter.java +0 -606
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseJSON.java +0 -109
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseMeta.java +0 -101
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseModule.java +0 -146
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebasePreferences.java +0 -96
- package/android/src/reactnative/java/io/invertase/firebase/common/SharedUtils.java +0 -441
- package/android/src/reactnative/java/io/invertase/firebase/utils/NativeRNFBTurboUtils.java +0 -223
- package/android/src/test/java/io/invertase/firebase/common/RNFBHandleMapTest.java +0 -275
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseJSONTest.java +0 -108
- package/android/src/test/java/io/invertase/firebase/common/TaskExecutorServiceTest.java +0 -97
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#import "FirebaseCore/FirebaseCore.h"
|
|
18
|
+
#import "RNFBAppModule.h"
|
|
19
|
+
|
|
20
|
+
#if __has_include(<RNFBApp/RNFBApp-Swift.h>)
|
|
21
|
+
#import <RNFBApp/RNFBApp-Swift.h>
|
|
22
|
+
#elif __has_include("RNFBApp-Swift.h")
|
|
23
|
+
#import "RNFBApp-Swift.h"
|
|
24
|
+
#elif __has_include("RNFBHandleMapStorage-Swift.inc")
|
|
25
|
+
#import "RNFBHandleMapStorage-Swift.inc"
|
|
26
|
+
#else
|
|
27
|
+
#error "RNFBApp Swift interface not found"
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
const NSString *RNFBVersionString = @"unit-test";
|
|
31
|
+
|
|
32
|
+
@interface RNFBAppModule (Testing)
|
|
33
|
+
+ (void)setCustomDomain:(nullable NSString *)authDomain forAppName:(NSString *)appName;
|
|
34
|
+
+ (void)setCustomDomainForTesting:(NSString *)domain forAppName:(NSString *)appName;
|
|
35
|
+
+ (void)resetCustomDomainsForTesting;
|
|
36
|
+
@end
|
|
37
|
+
|
|
38
|
+
@implementation RNFBAppModule (Testing)
|
|
39
|
+
|
|
40
|
+
+ (void)setCustomDomain:(nullable NSString *)authDomain forAppName:(NSString *)appName {
|
|
41
|
+
if (appName == nil) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
[RNFBAppCustomAuthDomains setCustomDomain:authDomain forAppName:appName];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
+ (void)setCustomDomainForTesting:(NSString *)domain forAppName:(NSString *)appName {
|
|
48
|
+
[self setCustomDomain:domain forAppName:appName];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
+ (void)resetCustomDomainsForTesting {
|
|
52
|
+
[RNFBAppCustomAuthDomains resetCustomDomainsForTesting];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@end
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Host-only stub for the codegen `RNFBAppTurboModules.h` (macOS XCTest). It models only the
|
|
19
|
+
* TurboModule types the shipped `RNFBAppModule.mm` / `RNFBUtilsModule.mm` shells name, so
|
|
20
|
+
* those files compile unchanged in the unit-test target. Not shipped in the production pod.
|
|
21
|
+
*/
|
|
22
|
+
#import <Foundation/Foundation.h>
|
|
23
|
+
#import <React/RCTBridgeModule.h>
|
|
24
|
+
|
|
25
|
+
#include <memory>
|
|
26
|
+
|
|
27
|
+
namespace facebook {
|
|
28
|
+
namespace react {
|
|
29
|
+
|
|
30
|
+
class TurboModule {
|
|
31
|
+
public:
|
|
32
|
+
virtual ~TurboModule() = default;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
class ObjCTurboModule : public TurboModule {
|
|
36
|
+
public:
|
|
37
|
+
struct InitParams {
|
|
38
|
+
const char *moduleName = "";
|
|
39
|
+
};
|
|
40
|
+
explicit ObjCTurboModule(const InitParams ¶ms) : moduleName_(params.moduleName) {}
|
|
41
|
+
const char *moduleName() const { return moduleName_; }
|
|
42
|
+
|
|
43
|
+
private:
|
|
44
|
+
const char *moduleName_;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
class NativeRNFBTurboAppSpecJSI : public ObjCTurboModule {
|
|
48
|
+
public:
|
|
49
|
+
explicit NativeRNFBTurboAppSpecJSI(const InitParams ¶ms) : ObjCTurboModule(params) {}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
class NativeRNFBTurboUtilsSpecJSI : public ObjCTurboModule {
|
|
53
|
+
public:
|
|
54
|
+
explicit NativeRNFBTurboUtilsSpecJSI(const InitParams ¶ms) : ObjCTurboModule(params) {}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** Untyped storage the host `_RCTTypedModuleConstants` returns. */
|
|
58
|
+
struct ModuleConstantsStorage {
|
|
59
|
+
NSDictionary *dictionary = nil;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
template <typename T>
|
|
63
|
+
struct ModuleConstants {
|
|
64
|
+
NSDictionary *dictionary = nil;
|
|
65
|
+
ModuleConstants() = default;
|
|
66
|
+
ModuleConstants(const ModuleConstantsStorage &storage) : dictionary(storage.dictionary) {}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
} // namespace react
|
|
70
|
+
} // namespace facebook
|
|
71
|
+
|
|
72
|
+
namespace JS {
|
|
73
|
+
namespace NativeRNFBTurboApp {
|
|
74
|
+
struct Constants {};
|
|
75
|
+
} // namespace NativeRNFBTurboApp
|
|
76
|
+
namespace NativeRNFBTurboUtils {
|
|
77
|
+
struct Constants {};
|
|
78
|
+
} // namespace NativeRNFBTurboUtils
|
|
79
|
+
} // namespace JS
|
|
80
|
+
|
|
81
|
+
@interface _RCTTypedModuleConstants : NSObject
|
|
82
|
+
+ (facebook::react::ModuleConstantsStorage)newWithUnsafeDictionary:(NSDictionary *)dictionary;
|
|
83
|
+
@end
|
|
84
|
+
|
|
85
|
+
@protocol NativeRNFBTurboAppSpec <RCTBridgeModule>
|
|
86
|
+
@end
|
|
87
|
+
|
|
88
|
+
@protocol NativeRNFBTurboUtilsSpec <RCTBridgeModule>
|
|
89
|
+
@end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Host-only stub for macOS XCTest. Not shipped in the production pod.
|
|
19
|
+
*/
|
|
20
|
+
#import "RNFBAppTurboModules.h"
|
|
21
|
+
|
|
22
|
+
@implementation _RCTTypedModuleConstants
|
|
23
|
+
|
|
24
|
+
+ (facebook::react::ModuleConstantsStorage)newWithUnsafeDictionary:(NSDictionary *)dictionary {
|
|
25
|
+
facebook::react::ModuleConstantsStorage storage;
|
|
26
|
+
storage.dictionary = dictionary;
|
|
27
|
+
return storage;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-only stub for macOS XCTest (IosTest-AD-1). Not shipped in the production pod.
|
|
3
|
+
*/
|
|
4
|
+
#import <Foundation/Foundation.h>
|
|
5
|
+
|
|
6
|
+
@interface RCTBridge : NSObject
|
|
7
|
+
|
|
8
|
+
@property(nonatomic, readonly, nullable) NSString *lastModule;
|
|
9
|
+
@property(nonatomic, readonly, nullable) NSString *lastMethod;
|
|
10
|
+
@property(nonatomic, readonly, nullable) NSArray *lastArgs;
|
|
11
|
+
|
|
12
|
+
- (void)enqueueJSCall:(NSString *)module
|
|
13
|
+
method:(NSString *)method
|
|
14
|
+
args:(NSArray *)args
|
|
15
|
+
completion:(void (^)(void))completion;
|
|
16
|
+
|
|
17
|
+
- (void)resetLastJSCallForTesting;
|
|
18
|
+
|
|
19
|
+
@end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-only stub for macOS XCTest (IosTest-AD-1). Not shipped in the production pod.
|
|
3
|
+
*/
|
|
4
|
+
#import "RCTBridge.h"
|
|
5
|
+
|
|
6
|
+
@interface RCTBridge ()
|
|
7
|
+
@property(nonatomic, copy, readwrite, nullable) NSString *lastModule;
|
|
8
|
+
@property(nonatomic, copy, readwrite, nullable) NSString *lastMethod;
|
|
9
|
+
@property(nonatomic, strong, readwrite, nullable) NSArray *lastArgs;
|
|
10
|
+
@end
|
|
11
|
+
|
|
12
|
+
@implementation RCTBridge
|
|
13
|
+
|
|
14
|
+
- (void)enqueueJSCall:(NSString *)module
|
|
15
|
+
method:(NSString *)method
|
|
16
|
+
args:(NSArray *)args
|
|
17
|
+
completion:(void (^)(void))completion {
|
|
18
|
+
self.lastModule = [module copy];
|
|
19
|
+
self.lastMethod = [method copy];
|
|
20
|
+
self.lastArgs = [args copy];
|
|
21
|
+
if (completion) {
|
|
22
|
+
completion();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
- (void)resetLastJSCallForTesting {
|
|
27
|
+
self.lastModule = nil;
|
|
28
|
+
self.lastMethod = nil;
|
|
29
|
+
self.lastArgs = nil;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-only stub for macOS XCTest (IosTest-AD-1). Not shipped in the production pod.
|
|
3
|
+
*/
|
|
4
|
+
#import <Foundation/Foundation.h>
|
|
5
|
+
|
|
6
|
+
typedef void (^RCTPromiseResolveBlock)(id result);
|
|
7
|
+
typedef void (^RCTPromiseRejectBlock)(NSString *code, NSString *message, NSError *error);
|
|
8
|
+
|
|
9
|
+
@protocol RCTBridgeModule <NSObject>
|
|
10
|
+
@end
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Real macro also registers the class with the bridge in `+load`. Host tests only need
|
|
14
|
+
* the module name the shipped TurboModule shells export.
|
|
15
|
+
*/
|
|
16
|
+
#define RCT_EXPORT_MODULE(js_name) \
|
|
17
|
+
+(NSString *)moduleName { \
|
|
18
|
+
return @ #js_name; \
|
|
19
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-only stub for macOS XCTest (IosTest-AD-1). Not shipped in the production pod.
|
|
3
|
+
*/
|
|
4
|
+
#import <Foundation/Foundation.h>
|
|
5
|
+
|
|
6
|
+
#ifndef RCT_DEBUG
|
|
7
|
+
#define RCT_DEBUG 0
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
#ifndef RCT_DYNAMIC
|
|
11
|
+
#define RCT_DYNAMIC
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#ifndef RCTLogConvertError
|
|
15
|
+
#define RCTLogConvertError(json, type) \
|
|
16
|
+
do { \
|
|
17
|
+
} while (0)
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
#define RCT_CUSTOM_CONVERTER(type, name, code) \
|
|
21
|
+
+(type)name : (id)json RCT_DYNAMIC { \
|
|
22
|
+
return code; \
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@interface RCTConvert : NSObject
|
|
26
|
+
+ (NSString *)NSString:(id)json;
|
|
27
|
+
+ (NSDictionary *)NSDictionary:(id)json;
|
|
28
|
+
@end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-only stub for macOS XCTest (IosTest-AD-1). Not shipped in the production pod.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#import "RCTConvert.h"
|
|
6
|
+
|
|
7
|
+
@implementation RCTConvert
|
|
8
|
+
|
|
9
|
+
+ (NSString *)NSString:(id)json {
|
|
10
|
+
if ([json isKindOfClass:[NSString class]]) {
|
|
11
|
+
return json;
|
|
12
|
+
}
|
|
13
|
+
return [json description];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
+ (NSDictionary *)NSDictionary:(id)json {
|
|
17
|
+
if ([json isKindOfClass:[NSDictionary class]]) {
|
|
18
|
+
return json;
|
|
19
|
+
}
|
|
20
|
+
return nil;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Host-only stub for macOS XCTest (IosTest-AD-1). Not shipped in the production pod.
|
|
19
|
+
*/
|
|
20
|
+
#import <Foundation/Foundation.h>
|
|
21
|
+
|
|
22
|
+
@protocol RCTInvalidating <NSObject>
|
|
23
|
+
- (void)invalidate;
|
|
24
|
+
@end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-only Clang module so production Swift (`import FirebaseCore`) compiles against
|
|
3
|
+
* HostStubs in the macOS XCTest target. Not shipped in the production pod.
|
|
4
|
+
*/
|
|
5
|
+
module FirebaseCore {
|
|
6
|
+
header "FirebaseCore/FirebaseCore.h"
|
|
7
|
+
export *
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
module FirebaseInstallations {
|
|
11
|
+
header "FirebaseInstallations/FirebaseInstallations.h"
|
|
12
|
+
export *
|
|
13
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#import <XCTest/XCTest.h>
|
|
18
|
+
|
|
19
|
+
#import "FirebaseCore/FirebaseCore.h"
|
|
20
|
+
#import "RCTConvert+FIRApp.h"
|
|
21
|
+
#import "RNFBSharedUtils.h"
|
|
22
|
+
|
|
23
|
+
@interface RCTConvertFIRAppFacadeTests : XCTestCase
|
|
24
|
+
@end
|
|
25
|
+
|
|
26
|
+
@implementation RCTConvertFIRAppFacadeTests
|
|
27
|
+
|
|
28
|
+
- (void)tearDown {
|
|
29
|
+
[FIRApp resetRegistryForTesting];
|
|
30
|
+
[super tearDown];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
- (void)testFacadeDefaultDisplayNameUsesDefaultApp {
|
|
34
|
+
FIRApp *defaultApp = [[FIRApp alloc] initWithName:DEFAULT_APP_NAME
|
|
35
|
+
options:[[FIROptions alloc] init]];
|
|
36
|
+
[FIRApp setDefaultAppForTesting:defaultApp];
|
|
37
|
+
|
|
38
|
+
FIRApp *result = [RCTConvert firAppFromString:DEFAULT_APP_DISPLAY_NAME];
|
|
39
|
+
|
|
40
|
+
XCTAssertEqual(result, defaultApp);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
- (void)testFacadeNamedAppUsesAppNamed {
|
|
44
|
+
FIRApp *named = [[FIRApp alloc] initWithName:@"secondary" options:[[FIROptions alloc] init]];
|
|
45
|
+
[FIRApp registerAppForTesting:named];
|
|
46
|
+
|
|
47
|
+
FIRApp *result = [RCTConvert firAppFromString:@"secondary"];
|
|
48
|
+
|
|
49
|
+
XCTAssertEqual(result, named);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
- (void)testFacadeMissingNamedAppReturnsNil {
|
|
53
|
+
XCTAssertNil([RCTConvert firAppFromString:@"missing"]);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
- (void)testFacadePublicSelectorsUnchanged {
|
|
57
|
+
XCTAssertTrue([RCTConvert respondsToSelector:@selector(firAppFromString:)]);
|
|
58
|
+
XCTAssertTrue([RCTConvert respondsToSelector:@selector(FIRApp:)]);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import Foundation
|
|
18
|
+
import XCTest
|
|
19
|
+
|
|
20
|
+
private final class StubFIRAppToken: NSObject {
|
|
21
|
+
let label: String
|
|
22
|
+
init(label: String) {
|
|
23
|
+
self.label = label
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private final class StubFIRAppRegistry: NSObject, RNFBFIRAppLookingUp {
|
|
28
|
+
var defaultAppValue: AnyObject?
|
|
29
|
+
var namedApps: [String: AnyObject] = [:]
|
|
30
|
+
var lastNamedLookup: String?
|
|
31
|
+
|
|
32
|
+
func defaultApp() -> AnyObject? {
|
|
33
|
+
defaultAppValue
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
func appNamed(_ name: String) -> AnyObject? {
|
|
37
|
+
lastNamedLookup = name
|
|
38
|
+
return namedApps[name]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
final class RCTConvertFIRAppTests: XCTestCase {
|
|
43
|
+
func testDefaultDisplayNameReturnsDefaultApp() {
|
|
44
|
+
let registry = StubFIRAppRegistry()
|
|
45
|
+
let defaultApp = StubFIRAppToken(label: "default")
|
|
46
|
+
registry.defaultAppValue = defaultApp
|
|
47
|
+
registry.namedApps["[DEFAULT]"] = StubFIRAppToken(label: "should-not-use")
|
|
48
|
+
|
|
49
|
+
let result = RCTConvertFIRApp.firApp(fromString: "[DEFAULT]", registry: registry)
|
|
50
|
+
|
|
51
|
+
XCTAssertTrue(result === defaultApp)
|
|
52
|
+
XCTAssertNil(registry.lastNamedLookup)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
func testNamedAppUsesAppNamed() {
|
|
56
|
+
let registry = StubFIRAppRegistry()
|
|
57
|
+
let named = StubFIRAppToken(label: "secondary")
|
|
58
|
+
registry.namedApps["secondary"] = named
|
|
59
|
+
registry.defaultAppValue = StubFIRAppToken(label: "default")
|
|
60
|
+
|
|
61
|
+
let result = RCTConvertFIRApp.firApp(fromString: "secondary", registry: registry)
|
|
62
|
+
|
|
63
|
+
XCTAssertTrue(result === named)
|
|
64
|
+
XCTAssertEqual(registry.lastNamedLookup, "secondary")
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
func testMissingNamedAppReturnsNil() {
|
|
68
|
+
let registry = StubFIRAppRegistry()
|
|
69
|
+
let result = RCTConvertFIRApp.firApp(fromString: "missing", registry: registry)
|
|
70
|
+
XCTAssertNil(result)
|
|
71
|
+
XCTAssertEqual(registry.lastNamedLookup, "missing")
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#import <XCTest/XCTest.h>
|
|
18
|
+
|
|
19
|
+
#import "FirebaseCore/FirebaseCore.h"
|
|
20
|
+
#import "RCTConvert+FIROptions.h"
|
|
21
|
+
|
|
22
|
+
@interface RCTConvertFIROptionsFacadeTests : XCTestCase
|
|
23
|
+
@end
|
|
24
|
+
|
|
25
|
+
@implementation RCTConvertFIROptionsFacadeTests
|
|
26
|
+
|
|
27
|
+
- (void)testFacadeConvertRawOptionsMapsFieldsAndBundleID {
|
|
28
|
+
NSDictionary *raw = @{
|
|
29
|
+
@"appId" : @"app-id",
|
|
30
|
+
@"messagingSenderId" : @"sender-id",
|
|
31
|
+
@"apiKey" : @"api-key",
|
|
32
|
+
@"projectId" : @"project-id",
|
|
33
|
+
@"clientId" : @"client-id",
|
|
34
|
+
@"databaseURL" : @"https://example.firebaseio.com",
|
|
35
|
+
@"storageBucket" : @"example.appspot.com",
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
FIROptions *options = [RCTConvert convertRawOptions:raw];
|
|
39
|
+
NSString *expectedBundleID =
|
|
40
|
+
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"];
|
|
41
|
+
|
|
42
|
+
XCTAssertEqualObjects(options.googleAppID, @"app-id");
|
|
43
|
+
XCTAssertEqualObjects(options.GCMSenderID, @"sender-id");
|
|
44
|
+
XCTAssertEqualObjects(options.APIKey, @"api-key");
|
|
45
|
+
XCTAssertEqualObjects(options.projectID, @"project-id");
|
|
46
|
+
XCTAssertEqualObjects(options.clientID, @"client-id");
|
|
47
|
+
XCTAssertEqualObjects(options.databaseURL, @"https://example.firebaseio.com");
|
|
48
|
+
XCTAssertEqualObjects(options.storageBucket, @"example.appspot.com");
|
|
49
|
+
XCTAssertEqualObjects(options.bundleID, expectedBundleID);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
- (void)testFacadePublicSelectorsUnchanged {
|
|
53
|
+
XCTAssertTrue([RCTConvert respondsToSelector:@selector(convertRawOptions:)]);
|
|
54
|
+
XCTAssertTrue([RCTConvert respondsToSelector:@selector(FIROptions:)]);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@end
|