[tests] initialise default app natively to work around Firebase Perf hard requirement on default app plist/json setup

This commit is contained in:
Salakar
2019-02-05 02:36:50 +00:00
parent 51e83a0adc
commit d47830b702
5 changed files with 15 additions and 12 deletions

View File

@@ -4,15 +4,15 @@ describe('App -> NativeModules -> Constants', () => {
const { apps } = NativeModules.RNFBAppModule;
apps.should.be.an.Array();
// secondaryFromNative
apps.length.should.equal(1);
// secondaryFromNative + default
apps.length.should.equal(2);
});
it('array items contain name, options & state properties', () => {
const { apps } = NativeModules.RNFBAppModule;
apps.should.be.an.Array();
apps.length.should.equal(1);
apps.length.should.equal(2);
for (let i = 0; i < apps.length; i++) {
const app = apps[i];

View File

@@ -1,7 +1,7 @@
describe('firebase', () => {
it('it should allow creating the default app in JS', () => {
it('it should allow read the default app from native', () => {
// app is created in tests app before all hook
should.equal(firebase.app()._nativeInitialized, false);
should.equal(firebase.app()._nativeInitialized, true);
should.equal(firebase.app().name, '[DEFAULT]');
});

View File

@@ -20,11 +20,11 @@
android:label="@string/app_name"
android:launchMode="singleTask"
android:theme="@style/AppTheme">
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:authorities="${applicationId}.firebaseinitprovider"
tools:node="remove"
/>
<!--<provider-->
<!--android:name="com.google.firebase.provider.FirebaseInitProvider"-->
<!--android:authorities="${applicationId}.firebaseinitprovider"-->
<!--tools:node="remove"-->
<!--/>-->
<!--<service-->
<!--android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService"-->

View File

@@ -4,8 +4,10 @@ const { detox: config } = require('../package.json');
const PACKAGES = [
'app',
'analytics',
'iid',
'perf',
'functions',
'analytics',
// 'auth',
// 'config',
// 'crashlytics',
@@ -22,7 +24,6 @@ for (let i = 0; i < PACKAGES.length; i++) {
before(async () => {
await detox.init(config);
await firebase.initializeApp(TestHelpers.core.config());
});
beforeEach(async function beforeEach() {

View File

@@ -7,9 +7,11 @@
//#import <RNFirebaseNotifications.h>
//#import <RNFirebaseLinks.h>
//@import GoogleSignIn;
@import Firebase;
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FIRApp configure];
[FIRApp configureWithName:@"secondaryFromNative" options:[FIROptions defaultOptions]];
// [GIDSignIn sharedInstance].clientID = [FIRApp defaultApp].options.clientID;