[tests] update firebase helper to initialize additional apps
This commit is contained in:
parent
075cd690ce
commit
2d744b162e
|
@ -50,6 +50,15 @@ class FirebaseCore {
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo validate required options
|
// todo validate required options
|
||||||
|
// todo required:
|
||||||
|
/*
|
||||||
|
appProps.put("apiKey", appOptions.getApiKey());
|
||||||
|
appProps.put("applicationId", appOptions.getApplicationId());
|
||||||
|
appProps.put("databaseUrl", appOptions.getDatabaseUrl());
|
||||||
|
appProps.put("messagingSenderId", appOptions.getGcmSenderId());
|
||||||
|
appProps.put("projectId", appOptions.getProjectId());
|
||||||
|
appProps.put("storageBucket", appOptions.getStorageBucket());
|
||||||
|
*/
|
||||||
|
|
||||||
if (name && !isString(name)) {
|
if (name && !isString(name)) {
|
||||||
throw new Error(INTERNALS.STRINGS.ERROR_INIT_STRING_NAME);
|
throw new Error(INTERNALS.STRINGS.ERROR_INIT_STRING_NAME);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import firebase from 'firebase';
|
import firebase from 'firebase';
|
||||||
import RNfirebase from './../firebase/firebase';
|
import RNfirebase from './../firebase/firebase';
|
||||||
|
import { Platform } from 'react-native';
|
||||||
|
|
||||||
import DatabaseContents from './tests/support/DatabaseContents';
|
import DatabaseContents from './tests/support/DatabaseContents';
|
||||||
|
|
||||||
|
@ -11,13 +12,46 @@ const config = {
|
||||||
messagingSenderId: '305229645282',
|
messagingSenderId: '305229645282',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const android = {
|
||||||
|
// firebase android sdk completely ignores client id
|
||||||
|
clientId: '305229645282-j8ij0jev9ut24odmlk9i215pas808ugn.apps.googleusercontent.com',
|
||||||
|
appId: '1:305229645282:android:efe37851d57e1d05',
|
||||||
|
apiKey: 'AIzaSyDnVqNhxU0Biit9nCo4RorAh5ulQQwko3E',
|
||||||
|
databaseURL: 'https://rnfirebase-b9ad4.firebaseio.com',
|
||||||
|
storageBucket: 'rnfirebase-b9ad4.appspot.com',
|
||||||
|
messagingSenderId: '305229645282',
|
||||||
|
projectId: 'rnfirebase-b9ad4',
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const ios = {
|
||||||
|
clientId: '305229645282-22imndi01abc2p6esgtu1i1m9mqrd0ib.apps.googleusercontent.com',
|
||||||
|
androidClientId: android.clientId,
|
||||||
|
appId: '1:305229645282:ios:7b45748cb1117d2d',
|
||||||
|
apiKey: 'AIzaSyDnVqNhxU0Biit9nCo4RorAh5ulQQwko3E',
|
||||||
|
databaseURL: 'https://rnfirebase-b9ad4.firebaseio.com',
|
||||||
|
storageBucket: 'rnfirebase-b9ad4.appspot.com',
|
||||||
|
messagingSenderId: '305229645282',
|
||||||
|
projectId: 'rnfirebase-b9ad4',
|
||||||
|
};
|
||||||
|
|
||||||
const instances = {
|
const instances = {
|
||||||
web: firebase.initializeApp(config),
|
web: firebase.initializeApp(config),
|
||||||
native: RNfirebase.app(),
|
native: RNfirebase.app(),
|
||||||
|
another: RNfirebase.initializeApp(Platform.OS === 'ios' ? ios : android, 'anotherApp'),
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('RNApps -->', RNfirebase.apps);
|
console.log('RNApps -->', RNfirebase.apps);
|
||||||
|
|
||||||
|
instances.native.auth().signInAnonymously().then((user) => {
|
||||||
|
console.log('defaultApp user ->', user.toJSON());
|
||||||
|
});
|
||||||
|
|
||||||
|
instances.another.auth().signInAnonymously().then((user) => {
|
||||||
|
console.log('anotherApp user ->', user.toJSON());
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
instances.web.database().ref('tests/types').set(DatabaseContents.DEFAULT);
|
instances.web.database().ref('tests/types').set(DatabaseContents.DEFAULT);
|
||||||
|
|
||||||
instances.web.database().ref('tests/priority').setWithPriority({
|
instances.web.database().ref('tests/priority').setWithPriority({
|
||||||
|
|
Loading…
Reference in New Issue