remove old bridge folder

This commit is contained in:
Salakar 2018-08-25 12:44:40 +01:00
parent 4485c5eb73
commit 17b33e7f1d
99 changed files with 0 additions and 27030 deletions

View File

@ -1,32 +0,0 @@
{
"presets": [
"react-native"
],
"env": {
"development": {
"plugins": [
[
"module-resolver",
{
"alias": {
"react-native-firebase": ".."
},
"extensions": [".js", ".ios.js", ".android.js"],
"stripExtensions": [".js"]
}
],
[
"istanbul",
{
"useInlineSourceMaps": true,
"instrument": true,
"relativePath": false,
"include": [
"**/dist/**"
]
}
]
]
}
}
}

View File

@ -1,6 +0,0 @@
[android]
target = Google Inc.:Google APIs:23
[maven_repositories]
central = https://repo1.maven.org/maven2

View File

@ -1,10 +0,0 @@
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

View File

@ -1,39 +0,0 @@
{
"extends": [
"airbnb",
"prettier",
"prettier/flowtype",
"prettier/react"
],
"parser": "babel-eslint",
"plugins": [
"flowtype",
"prettier"
],
"env": {
"es6": true,
"jasmine": true
},
"rules": {
"prettier/prettier": ["error", {
"trailingComma": "es5",
"singleQuote": true
}],
"react/forbid-prop-types": "warn",
"react/jsx-filename-extension": [
"off", { "extensions": [".js", ".jsx"] }
],
"class-methods-use-this": 0,
"no-console": 0,
"no-plusplus": 0,
"no-undef": 0,
"no-underscore-dangle": "off",
"no-use-before-define": 0
},
"globals": {
"__DEV__": true,
"window": true
}
}

View File

@ -1,5 +0,0 @@
{
"projects": {
"default": "rnfirebase-b9ad4"
}
}

View File

@ -1,97 +0,0 @@
[ignore]
# We fork some components by platform.
.*/*.web.js
.*/*.android.js
# Some modules have their own node_modules with overlap
.*/node_modules/node-haste/.*
# Ugh
.*/node_modules/babel.*
.*/node_modules/babylon.*
.*/node_modules/invariant.*
# Ignore react and fbjs where there are overlaps, but don't ignore
# anything that react-native relies on
.*/node_modules/fbjs/lib/Map.js
.*/node_modules/fbjs/lib/ErrorUtils.js
# Flow has a built-in definition for the 'react' module which we prefer to use
# over the currently-untyped source
.*/node_modules/react/react.js
.*/node_modules/react/lib/React.js
.*/node_modules/react/lib/ReactDOM.js
.*/__mocks__/.*
.*/__tests__/.*
.*/commoner/test/source/widget/share.js
# Ignore commoner tests
.*/node_modules/commoner/test/.*
# See https://github.com/facebook/flow/issues/442
.*/react-tools/node_modules/commoner/lib/reader.js
# Ignore jest
.*/node_modules/jest-cli/.*
# Ignore Website
.*/website/.*
# Ignore generators
.*/local-cli/generator.*
# Ignore BUCK generated folders
.*\.buckd/
# Ignore RNPM
.*/local-cli/rnpm/.*
.*/node_modules/is-my-json-valid/test/.*\.json
.*/node_modules/iconv-lite/encodings/tables/.*\.json
.*/node_modules/y18n/test/.*\.json
.*/node_modules/spdx-license-ids/spdx-license-ids.json
.*/node_modules/spdx-exceptions/index.json
.*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json
.*/node_modules/resolve/lib/core.json
.*/node_modules/jsonparse/samplejson/.*\.json
.*/node_modules/json5/test/.*\.json
.*/node_modules/ua-parser-js/test/.*\.json
.*/node_modules/builtin-modules/builtin-modules.json
.*/node_modules/binary-extensions/binary-extensions.json
.*/node_modules/url-regex/tlds.json
.*/node_modules/joi/.*\.json
.*/node_modules/isemail/.*\.json
.*/node_modules/tr46/.*\.json
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow
flow/
[options]
module.system=haste
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
munge_underscores=true
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
[version]
^0.25.0

41
bridge/.gitignore vendored
View File

@ -1,41 +0,0 @@
# OSX
#
.DS_Store
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
# Android/IJ
#
.idea
.gradle
local.properties
# node.js
#
node_modules/
npm-debug.log
# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore
.vscode

View File

@ -1 +0,0 @@
{}

View File

@ -1,81 +0,0 @@
# React Native Firebase - Testing Project
## Requirements
* Make sure you have Xcode installed (tested with Xcode 8.1-8.2).
* make sure you have node installed (`brew install node`, node 7.6.0 and up is required.
* Make sure you have react-native dependencies installed:
* react-native-cli is installed (`npm install -g react-native-cli`)
* watchman is installed (`brew install watchman`)
* [appleSimUtils](https://github.com/wix/AppleSimulatorUtils)
* detox-cli `npm install -g detox-cli`
### Step 1: Npm install
* Run `npm install`.
## To test build of your app
### Step 2: Build
* Build the demo project
```sh
detox build --configuration ios.sim.debug
```
### Step 3: Test
* start react-native packager
```sh
npm run start
```
* Run tests on the demo project
```sh
detox test --configuration ios.sim.debug
```
This action will open a new simulator and run the tests on it.
### TODO - Troubleshooting
Gradle issues... https://stackoverflow.com/questions/46917365/error-could-not-initialize-class-com-android-sdklib-repository-androidsdkhandle?rq=1
mac: `export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"`
windows `"C://Program Files/Java/jdk_1.x_"`
android sdk root `export ANDROID_SDK_ROOT="/Users/mike/Library/Android/sdk"`
Add platform-tools to your path
echo 'export ANDROID_HOME=/Users/$USER/Library/Android/sdk' >> ~/.bash_profile
echo 'export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools' >> ~/.bash_profile
Name: TestingAVD
CPU/ABI: null (null)
Path: /Users/mike/.android/avd/Actually_THIS_one.avd
Error: Failed to parse properties from /Users/mike/.android/avd/Actually_THIS_one.avd/config.ini
#### Running specific tests
Mocha supports the `.only` syntax, e.g. instead of `describe(...) || it(...)` you can use `describe.only(...) || it.only(...)` to only run that specific context or test.
Another way to do this is via adding a `--grep` option to e2e/mocha.opts file, e.g. `--grep auth` for all tests that have auth in the file path or tests descriptions.
#### Running Node debugger
Add `--inspect` to e2e/mocha.opts file
To open node debugger tools on chrome navigate to chrome://inspect/#devices and click the `Open dedicated DevTools for Node` link.
Add the default connection of `localhost:9229` if you haven't already - then the debugger will automatically connect everytime you start tests with inspect flag.
#### Mocha options
See https://mochajs.org/#usage

View File

@ -1,10 +0,0 @@
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

View File

@ -1,66 +0,0 @@
import re
# To learn about Buck see [Docs](https://buckbuild.com/).
# To run your application with Buck:
# - install Buck
# - `npm start` - to start the packager
# - `cd android`
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US`
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
# - `buck install -r android/app` - compile, install and run application
#
lib_deps = []
for jarfile in glob(['libs/*.jar']):
name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile)
lib_deps.append(':' + name)
prebuilt_jar(
name = name,
binary_jar = jarfile,
)
for aarfile in glob(['libs/*.aar']):
name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile)
lib_deps.append(':' + name)
android_prebuilt_aar(
name = name,
aar = aarfile,
)
android_library(
name = 'all-libs',
exported_deps = lib_deps
)
android_library(
name = 'app-code',
srcs = glob([
'src/main/java/**/*.java',
]),
deps = [
':all-libs',
':build_config',
':res',
],
)
android_build_config(
name = 'build_config',
package = 'com.example',
)
android_resource(
name = 'res',
res = 'src/main/res',
package = 'com.example',
)
android_binary(
name = 'app',
package_type = 'debug',
manifest = 'src/main/AndroidManifest.xml',
keystore = '//android/keystores:debug',
deps = [
':app-code',
],
)

View File

@ -1,160 +0,0 @@
apply plugin: "com.android.application"
apply plugin: "com.google.firebase.firebase-perf"
apply plugin: 'io.fabric'
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 27
// buildToolsVersion '27.0.2'
defaultConfig {
applicationId "com.testing"
minSdkVersion 18
targetSdkVersion 27
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
missingDimensionStrategy "minReactNative", "minReactNative46"
multiDexEnabled true
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
storeFile file("keystore.jks")
storePassword "12345678"
keyAlias "key0"
keyPassword "12345678"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a": 1, "x86": 2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
implementation "com.facebook.react:react-native:+"
implementation fileTree(dir: "libs", include: ["*.jar"])
/* ----------------------------
* REACT NATIVE FIREBASE
* ---------------------------- */
// Library as defined in settings.gradle
implementation project(':react-native-firebase')
// Required dependencies
//noinspection GradleCompatible
implementation "com.google.firebase:firebase-core:16.0.3"
implementation "com.google.android.gms:play-services-base:15.0.1"
/* -------------------------
* OPTIONAL FIREBASE SDKS
* ------------------------- */
// Ads
implementation('com.google.firebase:firebase-ads:15.0.1') {
// exclude `customtabs` as the support lib version is out of date
// we manually add it as a dependency below with a custom version
exclude group: 'com.android.support', module: 'customtabs'
}
// Authentication
implementation "com.google.firebase:firebase-auth:16.0.3"
// Performance Monitoring
implementation "com.google.firebase:firebase-perf:16.1.0"
// Remote Config
implementation "com.google.firebase:firebase-config:16.0.0"
// Cloud Storage
implementation "com.google.firebase:firebase-storage:16.0.1"
// Invites
implementation "com.google.firebase:firebase-invites:16.0.3"
// Real-time Database
implementation "com.google.firebase:firebase-database:16.0.1"
// Cloud Functions
implementation "com.google.firebase:firebase-functions:16.1.0"
// Cloud Firestore
implementation "com.google.firebase:firebase-firestore:17.1.0"
// Cloud Messaging / FCM
implementation "com.google.firebase:firebase-messaging:17.3.0"
// Crashlytics
implementation('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') {
transitive = true
}
/* --------------------------------
* OPTIONAL ANDROID SUPPORT LIBS
* -------------------------------- */
// For Firebase Ads
implementation "com.android.support:customtabs:27.1.1"
// For React Native Firebase Notifications
implementation "com.android.support:appcompat-v7:27.1.1"
implementation 'com.android.support:support-annotations:27.1.1'
/* ------------------------
* TESTING SDKS/LIBRARIES
* ------------------------ */
implementation(project(':jet')) {
transitive = false
}
androidTestImplementation(project(path: ":detox"))
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'

View File

@ -1,152 +0,0 @@
{
"project_info": {
"project_number": "305229645282",
"firebase_url": "https://rnfirebase-b9ad4.firebaseio.com",
"project_id": "rnfirebase-b9ad4",
"storage_bucket": "rnfirebase-b9ad4.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:305229645282:android:efe37851d57e1d05",
"android_client_info": {
"package_name": "com.reactnativefirebasedemo"
}
},
"oauth_client": [
{
"client_id": "305229645282-5fgq5kq024eqpvji5o0i7jq7q7bnnpl9.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.reactnativefirebasedemo",
"certificate_hash": "1f92c8aab0a091a3aaccfa144bf402bb97273494"
}
},
{
"client_id": "305229645282-cvp6v0iogjjuuvi5g2dcb3lrr9n884a3.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.reactnativefirebasedemo",
"certificate_hash": "859f2afac694e21d26ca67e750c9875107c2e755"
}
},
{
"client_id": "305229645282-j8ij0jev9ut24odmlk9i215pas808ugn.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCzbBYFyX8d6VdSu7T4s10IWYbPc-dguwM"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "305229645282-t29pn6o2t7se1f7rvrfsll4r0pvd6fb6.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.invertase.RNFirebaseTests"
}
},
{
"client_id": "305229645282-j8ij0jev9ut24odmlk9i215pas808ugn.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:305229645282:android:c9de0f8cb930daf5",
"android_client_info": {
"package_name": "com.reactnativefirebaseexamples"
}
},
"oauth_client": [
{
"client_id": "305229645282-hu7tr12kgn5lfhq82l51b1sh66aaue5f.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.reactnativefirebaseexamples",
"certificate_hash": "1f92c8aab0a091a3aaccfa144bf402bb97273494"
}
},
{
"client_id": "305229645282-j8ij0jev9ut24odmlk9i215pas808ugn.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCzbBYFyX8d6VdSu7T4s10IWYbPc-dguwM"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "305229645282-t29pn6o2t7se1f7rvrfsll4r0pvd6fb6.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.invertase.RNFirebaseTests"
}
},
{
"client_id": "305229645282-j8ij0jev9ut24odmlk9i215pas808ugn.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:305229645282:android:af36d4d29a83e04c",
"android_client_info": {
"package_name": "com.testing"
}
},
"oauth_client": [
{
"client_id": "305229645282-j8ij0jev9ut24odmlk9i215pas808ugn.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCzbBYFyX8d6VdSu7T4s10IWYbPc-dguwM"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}

Binary file not shown.

View File

@ -1,63 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Disabling obfuscation is useful if you collect stack traces from production crashes
# (unless you are using a system that supports de-obfuscate the stack traces).
-dontobfuscate
# React Native
# Keep our interfaces so they can be used by other ProGuard rules.
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.proguard.annotations.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.proguard.annotations.DoNotStrip *;
}
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
void set*(***);
*** get*();
}
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
-dontwarn com.facebook.react.**
# okhttp
-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
# okio
-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**

View File

@ -1,24 +0,0 @@
package com.testing;
import android.support.test.filters.LargeTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import com.wix.detox.Detox;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DetoxTest {
@Rule
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false);
@Test
public void runDetoxTests() throws InterruptedException {
Detox.runTests(mActivityRule);
}
}

View File

@ -1,111 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.testing">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name="com.testing.MainApplication"
android:allowBackup="false"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:launchMode="singleTask"
android:theme="@style/AppTheme">
<service
android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService"
android:enabled="true"
android:exported="true"
tools:ignore="ExportedService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service
android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service android:name="io.invertase.firebase.messaging.RNFirebaseBackgroundMessagingService" />
<receiver android:name="io.invertase.firebase.notifications.RNFirebaseNotificationReceiver" />
<receiver
android:name="io.invertase.firebase.notifications.RNFirebaseNotificationsRebootReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<activity
android:name="com.testing.MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- App Links -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="http"
android:host="je786.app.goo.gl" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="http"
android:host="je786.app.goo.gl" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="je786.app.goo.gl" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="je786.app.goo.gl" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>

View File

@ -1,84 +0,0 @@
package com.testing;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
public static final int PERMISSION_REQ_CODE = 1234;
public static final int OVERLAY_PERMISSION_REQ_CODE = 1235;
String[] perms = {
"android.permission.READ_EXTERNAL_STORAGE",
"android.permission.WRITE_EXTERNAL_STORAGE"
};
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "testing";
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
checkWindowPerms();
// ATTENTION: This was auto-generated to handle app links.
Intent appLinkIntent = getIntent();
String appLinkAction = appLinkIntent.getAction();
Uri appLinkData = appLinkIntent.getData();
}
public void checkWindowPerms() {
// Checking if device version > 22 and we need to use new permission model
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) {
// Checking if we can draw window overlay
if (!Settings.canDrawOverlays(this)) {
// Requesting permission for window overlay(needed for all react-native apps)
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE);
}
for (String perm : perms) {
// Checking each permission and if denied then requesting permissions
if (checkSelfPermission(perm) == PackageManager.PERMISSION_DENIED) {
requestPermissions(perms, PERMISSION_REQ_CODE);
break;
}
}
}
}
// Window overlay permission intent result
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == OVERLAY_PERMISSION_REQ_CODE) {
checkWindowPerms();
}
}
// Permission results
@Override
public void onRequestPermissionsResult(int permsRequestCode, String[] permissions, int[] grantResults) {
switch (permsRequestCode) {
case PERMISSION_REQ_CODE:
// example how to get result of permissions requests (there can be more then one permission dialog)
// boolean readAccepted = grantResults[0]==PackageManager.PERMISSION_GRANTED;
// boolean writeAccepted = grantResults[1]==PackageManager.PERMISSION_GRANTED;
// checking permissions to prevent situation when user denied some permission
checkWindowPerms();
break;
}
}
}

View File

@ -1,76 +0,0 @@
package com.testing;
import android.app.Application;
import com.facebook.react.ReactApplication;
import io.salakar.bridge.RNBridgePackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.admob.RNFirebaseAdMobPackage;
import io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage;
import io.invertase.firebase.auth.RNFirebaseAuthPackage;
import io.invertase.firebase.config.RNFirebaseRemoteConfigPackage;
import io.invertase.firebase.database.RNFirebaseDatabasePackage;
import io.invertase.firebase.fabric.crashlytics.RNFirebaseCrashlyticsPackage;
import io.invertase.firebase.firestore.RNFirebaseFirestorePackage;
import io.invertase.firebase.functions.RNFirebaseFunctionsPackage;
import io.invertase.firebase.instanceid.RNFirebaseInstanceIdPackage;
import io.invertase.firebase.invites.RNFirebaseInvitesPackage;
//import io.invertase.firebase.links.RNFirebaseLinksPackage;
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
import io.invertase.firebase.perf.RNFirebasePerformancePackage;
import io.invertase.firebase.storage.RNFirebaseStoragePackage;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNBridgePackage(),
new RNFirebasePackage(),
new RNFirebaseAdMobPackage(),
new RNFirebaseAnalyticsPackage(),
new RNFirebaseAuthPackage(),
new RNFirebaseRemoteConfigPackage(),
new RNFirebaseCrashlyticsPackage(),
new RNFirebaseDatabasePackage(),
new RNFirebaseFirestorePackage(),
new RNFirebaseFunctionsPackage(),
new RNFirebaseInstanceIdPackage(),
new RNFirebaseInvitesPackage(),
// new RNFirebaseLinksPackage(),
new RNFirebaseMessagingPackage(),
new RNFirebaseNotificationsPackage(),
new RNFirebasePerformancePackage(),
new RNFirebaseStoragePackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1,3 +0,0 @@
<resources>
<string name="app_name">RNF Test</string>
</resources>

View File

@ -1,8 +0,0 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>

View File

@ -1,53 +0,0 @@
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.0.1'
classpath 'com.google.firebase:firebase-plugins:1.1.5'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
subprojects {
task listAllDependencies(type: DependencyReportTask) {}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
subprojects {
ext {
compileSdk = 27
buildTools = "27.0.3"
minSdk = 18
targetSdk = 26
}
afterEvaluate { project ->
if (!project.name.equalsIgnoreCase("app")
&& project.hasProperty("android")) {
android {
compileSdkVersion compileSdk
buildToolsVersion buildTools
defaultConfig {
minSdkVersion minSdk
targetSdkVersion targetSdk
}
}
}
}
}

View File

@ -1,18 +0,0 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useDeprecatedNdk=true

Binary file not shown.

View File

@ -1,6 +0,0 @@
#Sat Sep 09 20:32:40 IDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

164
bridge/android/gradlew vendored
View File

@ -1,164 +0,0 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

View File

@ -1,90 +0,0 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -1,8 +0,0 @@
keystore(
name = 'debug',
store = 'debug.keystore',
properties = 'debug.keystore.properties',
visibility = [
'PUBLIC',
],
)

View File

@ -1,4 +0,0 @@
key.store=debug.keystore
key.alias=androiddebugkey
key.store.password=android
key.alias.password=android

View File

@ -1,11 +0,0 @@
rootProject.name = 'RNFTests'
include ':jet'
project(':jet').projectDir = new File(rootProject.projectDir, '../node_modules/jet/android')
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, './../../android')
include ':app'
include ':detox'
project(':detox').projectDir = new File(rootProject.projectDir, '../node_modules/detox/android/detox')

View File

@ -1,31 +0,0 @@
/* eslint-disable import/extensions,import/no-unresolved */
import React, { Component } from 'react';
import { AppRegistry, Text, View } from 'react-native';
import bridge from 'jet/platform/react-native';
import firebase from 'react-native-firebase';
require('sinon');
require('should-sinon');
require('should');
class Root extends Component {
constructor(props) {
super(props);
this.state = {
message: '',
};
bridge.setBridgeProperty('module', firebase);
}
render() {
return (
<View>
<Text testID="messageText">{this.state.message}</Text>
</View>
);
}
}
AppRegistry.registerComponent('testing', () => Root);

View File

@ -1,193 +0,0 @@
describe('analytics()', () => {
describe('logEvent()', () => {
it('errors on using a reserved name', () => {
try {
firebase.analytics().logEvent('session_start');
} catch (e) {
e.message.should.containEql('reserved event');
}
});
it('errors if name not alphanumeric', () => {
try {
firebase.analytics().logEvent('!@£$%^&*');
} catch (e) {
e.message.should.containEql('is invalid');
}
});
it('errors if more than 25 params provided', () => {
try {
firebase.analytics().logEvent('fooby', {
1: 1,
2: 2,
3: 3,
4: 4,
5: 5,
6: 6,
7: 7,
8: 8,
9: 9,
10: 10,
11: 11,
12: 12,
13: 13,
14: 14,
15: 15,
16: 16,
17: 17,
18: 18,
19: 19,
20: 20,
21: 21,
22: 22,
23: 23,
24: 24,
25: 25,
26: 26,
});
} catch (e) {
e.message.should.containEql('Maximum number of parameters exceeded');
}
});
it('errors if name is not a string', () => {
(() => {
firebase.analytics().logEvent(123456);
}).should.throw(
`analytics.logEvent(): First argument 'name' is required and must be a string value.`
);
});
it('errors if params is not an object', () => {
(() => {
firebase.analytics().logEvent('test_event', 'this should be an object');
}).should.throw(
`analytics.logEvent(): Second optional argument 'params' must be an object if provided.`
);
});
it('log an event without parameters', () => {
firebase.analytics().logEvent('test_event');
});
it('log an event with parameters', () => {
firebase.analytics().logEvent('test_event', {
boolean: true,
number: 1,
string: 'string',
});
});
});
describe('setAnalyticsCollectionEnabled()', () => {
it('true', () => {
firebase.analytics().setAnalyticsCollectionEnabled(true);
});
it('false', () => {
firebase.analytics().setAnalyticsCollectionEnabled(false);
});
});
describe('setCurrentScreen()', () => {
it('screenName only', () => {
firebase.analytics().setCurrentScreen('test screen');
});
it('screenName with screenClassOverride', () => {
firebase
.analytics()
.setCurrentScreen('test screen', 'test class override');
});
xit('errors if screenName not a string', () => {
// TODO needs validations adding to lib
});
xit('errors if screenClassOverride not a string', () => {
// TODO needs validations adding to lib
});
});
describe('setMinimumSessionDuration()', () => {
it('default duration', () => {
firebase.analytics().setMinimumSessionDuration();
});
it('custom duration', () => {
firebase.analytics().setMinimumSessionDuration(10001);
});
});
describe('setSessionTimeoutDuration()', () => {
it('default duration', () => {
firebase.analytics().setSessionTimeoutDuration();
});
it('custom duration', () => {
firebase.analytics().setSessionTimeoutDuration(1800001);
});
});
describe('setUserId()', () => {
// nulls remove the field on firebase
it('allows a null values to be set', () => {
firebase.analytics().setUserId(null);
});
it('accepts string values', () => {
firebase.analytics().setUserId('test-id');
});
it('rejects none string none null values', () => {
try {
firebase.analytics().setUserId(33.3333);
} catch (e) {
e.message.should.containEql('must be a string');
}
});
});
describe('setUserProperty()', () => {
// nulls remove the field on firebase
it('allows a null values to be set', () => {
firebase.analytics().setUserProperty('fooby', null);
});
it('accepts string values', () => {
firebase.analytics().setUserProperty('fooby2', 'test-id');
});
it('rejects none string none null values', () => {
try {
firebase.analytics().setUserProperty('fooby3', 33.3333);
} catch (e) {
e.message.should.containEql('must be a string');
}
});
xit('errors if property name not a string', () => {
// TODO needs validations adding to lib
});
});
describe('setUserProperties()', () => {
// nulls remove the field on firebase
it('allows a null values to be set', () => {
firebase.analytics().setUserProperties({ fooby: null });
});
it('accepts string values', () => {
firebase.analytics().setUserProperties({ fooby2: 'test-id' });
});
it('rejects none string none null values', () => {
try {
firebase.analytics().setUserProperties({ fooby3: 33.3333 });
} catch (e) {
e.message.should.containEql('must be a string');
}
});
});
});

File diff suppressed because it is too large Load Diff

View File

@ -1,55 +0,0 @@
describe('auth() -> emailLink Provider', () => {
describe('sendSignInLinkToEmail', () => {
it('should send email', async () => {
const random = randomString(12, '#aA');
const email = `${random}@${random}.com`;
// const email = 'MANUAL TEST EMAIL HERE';
const actionCodeSettings = {
url: 'http://localhost:1337/authLinkFoo?bar=1234',
handleCodeInApp: true,
iOS: {
bundleId: 'com.testing',
},
android: {
packageName: 'com.testing',
installApp: true,
minimumVersion: '12',
},
};
await firebase.auth().sendSignInLinkToEmail(email, actionCodeSettings);
});
});
describe('isSignInWithEmailLink', () => {
it('should return true/false', async () => {
const emailLink1 =
'https://www.example.com/action?mode=signIn&oobCode=oobCode';
const emailLink2 =
'https://www.example.com/action?mode=verifyEmail&oobCode=oobCode';
const emailLink3 = 'https://www.example.com/action?mode=signIn';
const emailLink4 =
'https://x59dg.app.goo.gl/?link=https://rnfirebase-b9ad4.firebaseapp.com/__/auth/action?apiKey%3Dfoo%26mode%3DsignIn%26oobCode%3Dbar';
should.equal(true, firebase.auth().isSignInWithEmailLink(emailLink1));
should.equal(false, firebase.auth().isSignInWithEmailLink(emailLink2));
should.equal(false, firebase.auth().isSignInWithEmailLink(emailLink3));
should.equal(true, firebase.auth().isSignInWithEmailLink(emailLink4));
});
});
// FOR MANUAL TESTING ONLY
xdescribe('signInWithEmailLink', () => {
it('should signIn', async () => {
const email = 'MANUAL TEST EMAIL HERE';
const emailLink = 'MANUAL TEST CODE HERE';
const userCredential = await firebase
.auth()
.signInWithEmailLink(email, emailLink);
userCredential.user.email.should.equal(email);
await await firebase.auth().signOut();
});
});
});

View File

@ -1,3 +0,0 @@
xdescribe('auth() => Phone', () => {
// TODO mock native events using bridge's event inspector / mocking tools (still wip)
});

View File

@ -1,237 +0,0 @@
describe('auth() -> Providers', () => {
describe('EmailAuthProvider', () => {
describe('constructor', () => {
it('should throw an unsupported error', () => {
(() => new firebase.auth.EmailAuthProvider()).should.throw(
'`new EmailAuthProvider()` is not supported on the native Firebase SDKs.'
);
});
});
describe('credential', () => {
it('should return a credential object', () => {
const email = 'email@email.com';
const password = 'password';
const credential = firebase.auth.EmailAuthProvider.credential(
email,
password
);
credential.providerId.should.equal('password');
credential.token.should.equal(email);
credential.secret.should.equal(password);
});
});
describe('credentialWithLink', () => {
it('should return a credential object', () => {
const email = 'email@email.com';
const link = 'link';
const credential = firebase.auth.EmailAuthProvider.credentialWithLink(
email,
link
);
credential.providerId.should.equal('emailLink');
credential.token.should.equal(email);
credential.secret.should.equal(link);
});
});
describe('EMAIL_PASSWORD_SIGN_IN_METHOD', () => {
it('should return password', () => {
firebase.auth.EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD.should.equal(
'password'
);
});
});
describe('EMAIL_LINK_SIGN_IN_METHOD', () => {
it('should return emailLink', () => {
firebase.auth.EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD.should.equal(
'emailLink'
);
});
});
describe('PROVIDER_ID', () => {
it('should return password', () => {
firebase.auth.EmailAuthProvider.PROVIDER_ID.should.equal('password');
});
});
});
describe('FacebookAuthProvider', () => {
describe('constructor', () => {
it('should throw an unsupported error', () => {
(() => new firebase.auth.FacebookAuthProvider()).should.throw(
'`new FacebookAuthProvider()` is not supported on the native Firebase SDKs.'
);
});
});
describe('credential', () => {
it('should return a credential object', () => {
const token = '123456';
const credential = firebase.auth.FacebookAuthProvider.credential(token);
credential.providerId.should.equal('facebook.com');
credential.token.should.equal(token);
credential.secret.should.equal('');
});
});
describe('PROVIDER_ID', () => {
it('should return facebook.com', () => {
firebase.auth.FacebookAuthProvider.PROVIDER_ID.should.equal(
'facebook.com'
);
});
});
});
describe('GithubAuthProvider', () => {
describe('constructor', () => {
it('should throw an unsupported error', () => {
(() => new firebase.auth.GithubAuthProvider()).should.throw(
'`new GithubAuthProvider()` is not supported on the native Firebase SDKs.'
);
});
});
describe('credential', () => {
it('should return a credential object', () => {
const token = '123456';
const credential = firebase.auth.GithubAuthProvider.credential(token);
credential.providerId.should.equal('github.com');
credential.token.should.equal(token);
credential.secret.should.equal('');
});
});
describe('PROVIDER_ID', () => {
it('should return github.com', () => {
firebase.auth.GithubAuthProvider.PROVIDER_ID.should.equal('github.com');
});
});
});
describe('GoogleAuthProvider', () => {
describe('constructor', () => {
it('should throw an unsupported error', () => {
(() => new firebase.auth.GoogleAuthProvider()).should.throw(
'`new GoogleAuthProvider()` is not supported on the native Firebase SDKs.'
);
});
});
describe('credential', () => {
it('should return a credential object', () => {
const token = '123456';
const secret = '654321';
const credential = firebase.auth.GoogleAuthProvider.credential(
token,
secret
);
credential.providerId.should.equal('google.com');
credential.token.should.equal(token);
credential.secret.should.equal(secret);
});
});
describe('PROVIDER_ID', () => {
it('should return google.com', () => {
firebase.auth.GoogleAuthProvider.PROVIDER_ID.should.equal('google.com');
});
});
});
describe('OAuthProvider', () => {
describe('constructor', () => {
it('should throw an unsupported error', () => {
(() => new firebase.auth.OAuthProvider()).should.throw(
'`new OAuthProvider()` is not supported on the native Firebase SDKs.'
);
});
});
describe('credential', () => {
it('should return a credential object', () => {
const idToken = '123456';
const accessToken = '654321';
const credential = firebase.auth.OAuthProvider.credential(
idToken,
accessToken
);
credential.providerId.should.equal('oauth');
credential.token.should.equal(idToken);
credential.secret.should.equal(accessToken);
});
});
describe('PROVIDER_ID', () => {
it('should return oauth', () => {
firebase.auth.OAuthProvider.PROVIDER_ID.should.equal('oauth');
});
});
});
describe('PhoneAuthProvider', () => {
describe('constructor', () => {
it('should throw an unsupported error', () => {
(() => new firebase.auth.PhoneAuthProvider()).should.throw(
'`new PhoneAuthProvider()` is not supported on the native Firebase SDKs.'
);
});
});
describe('credential', () => {
it('should return a credential object', () => {
const verificationId = '123456';
const code = '654321';
const credential = firebase.auth.PhoneAuthProvider.credential(
verificationId,
code
);
credential.providerId.should.equal('phone');
credential.token.should.equal(verificationId);
credential.secret.should.equal(code);
});
});
describe('PROVIDER_ID', () => {
it('should return phone', () => {
firebase.auth.PhoneAuthProvider.PROVIDER_ID.should.equal('phone');
});
});
});
describe('TwitterAuthProvider', () => {
describe('constructor', () => {
it('should throw an unsupported error', () => {
(() => new firebase.auth.TwitterAuthProvider()).should.throw(
'`new TwitterAuthProvider()` is not supported on the native Firebase SDKs.'
);
});
});
describe('credential', () => {
it('should return a credential object', () => {
const token = '123456';
const secret = '654321';
const credential = firebase.auth.TwitterAuthProvider.credential(
token,
secret
);
credential.providerId.should.equal('twitter.com');
credential.token.should.equal(token);
credential.secret.should.equal(secret);
});
});
describe('PROVIDER_ID', () => {
it('should return twitter.com', () => {
firebase.auth.TwitterAuthProvider.PROVIDER_ID.should.equal(
'twitter.com'
);
});
});
});
});

View File

@ -1,485 +0,0 @@
describe('auth().currentUser', () => {
describe('getIdToken()', () => {
it('should return a token', async () => {
const random = randomString(12, '#aA');
const email = `${random}@${random}.com`;
const pass = random;
const newUser = await firebase
.auth()
.createUserWithEmailAndPassword(email, pass);
// Test
const token = await newUser.getIdToken();
// Assertions
token.should.be.a.String();
token.length.should.be.greaterThan(24);
// Clean up
await firebase.auth().currentUser.delete();
});
});
describe('getToken()', () => {
it('should return a token', async () => {
const random = randomString(12, '#aA');
const email = `${random}@${random}.com`;
const pass = random;
const newUser = await firebase
.auth()
.createUserWithEmailAndPassword(email, pass);
// Test
const token = await newUser.getToken();
// Assertions
token.should.be.a.String();
token.length.should.be.greaterThan(24);
// Clean up
await firebase.auth().currentUser.delete();
});
});
describe('linkWithCredential()', () => {
it('should link anonymous account <-> email account', async () => {
const random = randomString(12, '#aA');
const email = `${random}@${random}.com`;
const pass = random;
await firebase.auth().signInAnonymouslyAndRetrieveData();
const currentUser = firebase.auth().currentUser;
// Test
const credential = firebase.auth.EmailAuthProvider.credential(
email,
pass
);
const linkedUser = await currentUser.linkWithCredential(credential);
// Assertions
linkedUser.should.be.an.Object();
linkedUser.should.equal(firebase.auth().currentUser);
linkedUser.email.toLowerCase().should.equal(email.toLowerCase());
linkedUser.isAnonymous.should.equal(false);
linkedUser.providerId.should.equal('firebase');
linkedUser.providerData.should.be.an.Array();
linkedUser.providerData.length.should.equal(1);
// Clean up
await firebase.auth().currentUser.delete();
});
it('should error on link anon <-> email if email already exists', async () => {
const email = 'test@test.com';
const pass = 'test1234';
await firebase.auth().signInAnonymouslyAndRetrieveData();
const currentUser = firebase.auth().currentUser;
// Test
try {
const credential = firebase.auth.EmailAuthProvider.credential(
email,
pass
);
await currentUser.linkWithCredential(credential);
// Clean up
await firebase.auth().signOut();
// Reject
Promise.reject(new Error('Did not error on link'));
} catch (error) {
// Assertions
error.code.should.equal('auth/email-already-in-use');
error.message.should.equal(
'The email address is already in use by another account.'
);
// Clean up
await firebase.auth().currentUser.delete();
}
});
});
describe('linkAndRetrieveDataWithCredential()', () => {
it('should link anonymous account <-> email account', async () => {
const random = randomString(12, '#aA');
const email = `${random}@${random}.com`;
const pass = random;
await firebase.auth().signInAnonymouslyAndRetrieveData();
const currentUser = firebase.auth().currentUser;
// Test
const credential = firebase.auth.EmailAuthProvider.credential(
email,
pass
);
const linkedUserCredential = await currentUser.linkAndRetrieveDataWithCredential(
credential
);
// Assertions
const linkedUser = linkedUserCredential.user;
linkedUser.should.be.an.Object();
linkedUser.should.equal(firebase.auth().currentUser);
linkedUser.email.toLowerCase().should.equal(email.toLowerCase());
linkedUser.isAnonymous.should.equal(false);
linkedUser.providerId.should.equal('firebase');
linkedUser.providerData.should.be.an.Array();
linkedUser.providerData.length.should.equal(1);
// Clean up
await firebase.auth().currentUser.delete();
});
it('should error on link anon <-> email if email already exists', async () => {
const email = 'test@test.com';
const pass = 'test1234';
await firebase.auth().signInAnonymouslyAndRetrieveData();
const currentUser = firebase.auth().currentUser;
// Test
try {
const credential = firebase.auth.EmailAuthProvider.credential(
email,
pass
);
await currentUser.linkAndRetrieveDataWithCredential(credential);
// Clean up
await firebase.auth().signOut();
// Reject
Promise.reject(new Error('Did not error on link'));
} catch (error) {
// Assertions
error.code.should.equal('auth/email-already-in-use');
error.message.should.equal(
'The email address is already in use by another account.'
);
// Clean up
await firebase.auth().currentUser.delete();
}
});
});
describe('reauthenticateWithCredential()', () => {
it('should reauthenticate correctly', async () => {
const random = randomString(12, '#aA');
const email = `${random}@${random}.com`;
const pass = random;
await firebase
.auth()
.createUserAndRetrieveDataWithEmailAndPassword(email, pass);
// Test
const credential = firebase.auth.EmailAuthProvider.credential(
email,
pass
);
await firebase
.auth()
.currentUser.reauthenticateWithCredential(credential);
// Assertions
const currentUser = firebase.auth().currentUser;
currentUser.email.should.equal(email.toLowerCase());
// Clean up
await firebase.auth().currentUser.delete();
});
});
describe('reauthenticateAndRetrieveDataWithCredential()', () => {
it('should reauthenticate correctly', async () => {
const random = randomString(12, '#aA');
const email = `${random}@${random}.com`;
const pass = random;
await firebase
.auth()
.createUserAndRetrieveDataWithEmailAndPassword(email, pass);
// Test
const credential = firebase.auth.EmailAuthProvider.credential(
email,
pass
);
await firebase
.auth()
.currentUser.reauthenticateAndRetrieveDataWithCredential(credential);
// Assertions
const currentUser = firebase.auth().currentUser;
currentUser.email.should.equal(email.toLowerCase());
// Clean up
await firebase.auth().currentUser.delete();
});
});
describe('reload()', () => {
it('should not error', async () => {
await firebase.auth().signInAnonymouslyAndRetrieveData();
try {
await firebase.auth().currentUser.reload();
await firebase.auth().signOut();
} catch (error) {
// Reject
await firebase.auth().signOut();
Promise.reject(new Error('reload() caused an error', error));
}
});
});
describe('sendEmailVerification()', () => {
it('should not error', async () => {
const random = randomString(12, '#aA');
const email = `${random}@${random}.com`;
const pass = random;
await firebase
.auth()
.createUserAndRetrieveDataWithEmailAndPassword(email, pass);
try {
await firebase.auth().currentUser.sendEmailVerification();
await firebase.auth().currentUser.delete();
} catch (error) {
// Reject
await firebase.auth().currentUser.delete();
Promise.reject(
new Error('sendEmailVerification() caused an error', error)
);
}
});
});
describe('unlink()', () => {
it('should unlink the email address', async () => {
const random = randomString(12, '#aA');
const email = `${random}@${random}.com`;
const pass = random;
await firebase.auth().signInAnonymouslyAndRetrieveData();
const currentUser = firebase.auth().currentUser;
const credential = firebase.auth.EmailAuthProvider.credential(
email,
pass
);
await currentUser.linkAndRetrieveDataWithCredential(credential);
// Test
await currentUser.unlink(firebase.auth.EmailAuthProvider.PROVIDER_ID);
// Assertions
const unlinkedUser = firebase.auth().currentUser;
unlinkedUser.providerData.should.be.an.Array();
unlinkedUser.providerData.length.should.equal(0);
// Clean up
await firebase.auth().currentUser.delete();
});
});
describe('updateEmail()', () => {
it('should update the email address', async () => {
const random = randomString(12, '#aA');
const random2 = randomString(12, '#aA');
const email = `${random}@${random}.com`;
const email2 = `${random2}@${random2}.com`;
const pass = random;
// Setup
await firebase
.auth()
.createUserAndRetrieveDataWithEmailAndPassword(email, pass);
firebase
.auth()
.currentUser.email.toLowerCase()
.should.equal(email.toLowerCase());
// Update user email
await firebase.auth().currentUser.updateEmail(email2);
// Assertions
firebase
.auth()
.currentUser.email.toLowerCase()
.should.equal(email2.toLowerCase());
// Clean up
await firebase.auth().currentUser.delete();
});
});
describe('updatePassword()', () => {
it('should update the password', async () => {
const random = randomString(12, '#aA');
const random2 = randomString(12, '#aA');
const email = `${random}@${random}.com`;
const pass = random;
const pass2 = random2;
// Setup
await firebase
.auth()
.createUserAndRetrieveDataWithEmailAndPassword(email, pass);
// Update user password
await firebase.auth().currentUser.updatePassword(pass2);
// Sign out
await firebase.auth().signOut();
// Log in with the new password
await firebase
.auth()
.signInAndRetrieveDataWithEmailAndPassword(email, pass2);
// Assertions
firebase.auth().currentUser.should.be.an.Object();
firebase.auth().currentUser.email.should.equal(email.toLowerCase());
// Clean up
await firebase.auth().currentUser.delete();
});
});
describe('updateProfile()', () => {
it('should update the profile', async () => {
const random = randomString(12, '#aA');
const email = `${random}@${random}.com`;
const pass = random;
const displayName = random;
const photoURL = `http://${random}.com/${random}.jpg`;
// Setup
await firebase
.auth()
.createUserAndRetrieveDataWithEmailAndPassword(email, pass);
// Update user profile
await firebase.auth().currentUser.updateProfile({
displayName,
photoURL,
});
// Assertions
const user = firebase.auth().currentUser;
user.should.be.an.Object();
user.email.should.equal(email.toLowerCase());
user.displayName.should.equal(displayName);
user.photoURL.should.equal(photoURL);
// Clean up
await firebase.auth().currentUser.delete();
});
});
describe('linkWithPhoneNumber()', () => {
it('should throw an unsupported error', async () => {
await firebase.auth().signInAnonymouslyAndRetrieveData();
(() => {
firebase.auth().currentUser.linkWithPhoneNumber();
}).should.throw(
'User.linkWithPhoneNumber() is unsupported by the native Firebase SDKs.'
);
await firebase.auth().signOut();
});
});
describe('linkWithPopup()', () => {
it('should throw an unsupported error', async () => {
await firebase.auth().signInAnonymouslyAndRetrieveData();
(() => {
firebase.auth().currentUser.linkWithPopup();
}).should.throw(
'User.linkWithPopup() is unsupported by the native Firebase SDKs.'
);
await firebase.auth().signOut();
});
});
describe('linkWithRedirect()', () => {
it('should throw an unsupported error', async () => {
await firebase.auth().signInAnonymouslyAndRetrieveData();
(() => {
firebase.auth().currentUser.linkWithRedirect();
}).should.throw(
'User.linkWithRedirect() is unsupported by the native Firebase SDKs.'
);
await firebase.auth().signOut();
});
});
describe('reauthenticateWithPhoneNumber()', () => {
it('should throw an unsupported error', async () => {
await firebase.auth().signInAnonymouslyAndRetrieveData();
(() => {
firebase.auth().currentUser.reauthenticateWithPhoneNumber();
}).should.throw(
'User.reauthenticateWithPhoneNumber() is unsupported by the native Firebase SDKs.'
);
await firebase.auth().signOut();
});
});
describe('reauthenticateWithPopup()', () => {
it('should throw an unsupported error', async () => {
await firebase.auth().signInAnonymouslyAndRetrieveData();
(() => {
firebase.auth().currentUser.reauthenticateWithPopup();
}).should.throw(
'User.reauthenticateWithPopup() is unsupported by the native Firebase SDKs.'
);
await firebase.auth().signOut();
});
});
describe('reauthenticateWithRedirect()', () => {
it('should throw an unsupported error', async () => {
await firebase.auth().signInAnonymouslyAndRetrieveData();
(() => {
firebase.auth().currentUser.reauthenticateWithRedirect();
}).should.throw(
'User.reauthenticateWithRedirect() is unsupported by the native Firebase SDKs.'
);
await firebase.auth().signOut();
});
});
describe('updatePhoneNumber()', () => {
it('should throw an unsupported error', async () => {
await firebase.auth().signInAnonymouslyAndRetrieveData();
(() => {
firebase.auth().currentUser.updatePhoneNumber();
}).should.throw(
'User.updatePhoneNumber() is unsupported by the native Firebase SDKs.'
);
await firebase.auth().signOut();
});
});
describe('refreshToken', () => {
it('should throw an unsupported error', async () => {
await firebase.auth().signInAnonymouslyAndRetrieveData();
(() => firebase.auth().currentUser.refreshToken).should.throw(
'User.refreshToken is unsupported by the native Firebase SDKs.'
);
await firebase.auth().signOut();
});
});
});

View File

@ -1,124 +0,0 @@
const should = require('should');
describe('bridge', () => {
// beforeEach(async function beforeEach() {
// await device.reloadReactNative();
// bridge.root.setState({ message: this.currentTest.title });
// });
it('should provide -> global.bridge', async () => {
should(bridge).not.be.undefined();
return Promise.resolve();
});
// main react-native module you're testing on
// in our case react-native-firebase
it('should provide -> bridge.module', async () => {
should(bridge.module).not.be.undefined();
return Promise.resolve();
});
// react-native module access
it('should provide -> bridge.rn', () => {
should(bridge.rn).not.be.undefined();
should(bridge.rn.Platform.OS).be.a.String();
should(bridge.rn.Platform.OS).equal(device.getPlatform());
return Promise.resolve();
});
// 'global' context of the app's JS environment
it('should provide -> bridge.context', () => {
should(bridge.context).not.be.undefined();
should(bridge.context.setTimeout).be.a.Function();
should(bridge.context.window).be.a.Object();
// etc ... e.g. __coverage__ is here also if covering
return Promise.resolve();
});
// the apps root component
// allows you to read and set state if required
xit('should provide -> bridge.root', async () => {
should(bridge.root).not.be.undefined();
should(bridge.root.setState).be.a.Function();
should(bridge.root.state).be.a.Object();
// test setting state
await new Promise(resolve =>
bridge.root.setState({ message: 'hello world' }, resolve)
);
should(bridge.root.state.message).equal('hello world');
return Promise.resolve();
});
// we shim our own reloadReactNative functionality as the detox reloadReactNative built-in
// hangs often and seems unpredictable - todo: investigate & PR if solution found
// reloadReactNative is replaced on init with bridge.root automatically
xit('should allow reloadReactNative usage without breaking remote debug', async () => {
should(bridge.reload).be.a.Function();
// and check it works without breaking anything
await device.reloadReactNative();
should(bridge.reload).be.a.Function();
return Promise.resolve();
});
it('should allow launchApp usage without breaking remote debug', async () => {
should(bridge.module).not.be.undefined();
should(bridge.reload).be.a.Function();
should(bridge.rn).not.be.undefined();
should(bridge.rn.Platform.OS).be.a.String();
should(bridge.rn.Platform.OS).equal(device.getPlatform());
await device.launchApp({ newInstance: true });
should(bridge.module).not.be.undefined();
should(bridge.reload).be.a.Function();
should(bridge.rn).not.be.undefined();
should(bridge.rn.Platform.OS).be.a.String();
should(bridge.rn.Platform.OS).equal(device.getPlatform());
return Promise.resolve();
});
// TIMERS
it('timing.setTimeout', cb => {
const start = Date.now();
bridge.context.setTimeout(() => {
const timeTaken = Date.now() - start;
if (timeTaken >= 50) cb();
else cb(new Error('setTimeout fn called too soon.'));
}, 50);
});
it('timing.setInterval', cb => {
let times = 0;
let interval;
const start = Date.now();
interval = bridge.context.setInterval(() => {
const timeTaken = Date.now() - start;
times++;
bridge.context.clearInterval(interval);
if (times >= 2) {
return cb(new Error('Interval did not cancel correctly.'));
}
if (timeTaken < 50) {
return cb(new Error('setInterval fn called too soon.'));
}
return bridge.context.setTimeout(cb, 100);
}, 50);
});
it('timing.setImmediate', cb => {
bridge.context.setImmediate(() => cb());
});
it('timing.requestIdleCallback', cb => {
bridge.context.requestIdleCallback(() => cb());
});
it('timing.requestAnimationFrame', cb => {
bridge.context.requestAnimationFrame(() => cb());
});
});

View File

@ -1,97 +0,0 @@
describe('config()', () => {
before(() => {
firebase.config().enableDeveloperMode();
firebase.config().setDefaults({
foo: 'bar',
bar: 'baz',
});
});
describe('fetch()', () => {
it('with expiration provided', () => firebase.config().fetch(0));
it('without expiration provided', () => firebase.config().fetch());
});
describe('activateFetched()', () => {
it('with expiration provided', async () => {
await firebase.config().fetch(0);
const activated = await firebase.config().activateFetched();
activated.should.be.a.Boolean();
});
it('with expiration provided', async () => {
await firebase.config().fetch();
const activated = await firebase.config().activateFetched();
activated.should.be.a.Boolean();
});
});
describe('getValue()', () => {
it('gets a single value by key', async () => {
const config = await firebase.config().getValue('foo');
config.should.be.a.Object();
config.source.should.be.a.String();
config.val.should.be.a.Function();
config.val().should.be.equalOneOf('bar', true);
});
xit('errors if no key provided or is not a string', async () => {
// TODO needs input validation adding to lib
});
});
describe('getValues()', () => {
it('get multiple values by an array of keys', async () => {
const config = await firebase
.config()
.getValues(['foo', 'bar', 'foobar', 'numvalue']);
config.should.be.a.Object();
config.should.have.keys('foo', 'bar', 'foobar');
const fooValue = config.foo.val();
const barValue = config.bar.val();
const foobarValue = config.foobar.val();
const numvalueValue = config.numvalue.val();
fooValue.should.be.equal(true);
barValue.should.be.equal('baz');
foobarValue.should.be.equal('barbaz');
numvalueValue.should.be.equal(0);
});
xit('errors if any key is not a string', async () => {
// TODO needs input validation adding to lib
});
});
describe('getKeysByPrefix()', () => {
it('get keys beginning with the prefix provided', async () => {
const keys = await firebase.config().getKeysByPrefix('num');
keys.should.be.Array();
should.equal(keys.length, 2);
});
xit('get all keys as an array if no prefix provided', async () => {
// TODO flakey on Android
const keys = await firebase.config().getKeysByPrefix();
keys.should.be.Array();
should.equal(keys.length, 4);
});
xit('errors if prefix is not a string', async () => {
// TODO needs input validation adding to lib
});
});
describe('setDefaultsFromResource()', () => {
it('accepts a resource id/name to read defaults from', async () => {
if (device.getPlatform() === 'android')
firebase.config().setDefaultsFromResource(6666);
else firebase.config().setDefaultsFromResource();
// todo add plist/xml on ios/android to test
});
xit('errors if id not a integer for android or a string for ios', async () => {
// TODO needs input validation adding to lib
});
});
});

View File

@ -1,96 +0,0 @@
describe('Core', () => {
describe('Firebase', () => {
it('it should create js apps for natively initialized apps', () => {
should.equal(firebase.app()._nativeInitialized, true);
return Promise.resolve();
});
it('natively initialized apps should have options available in js', () => {
const platformAppConfig = TestHelpers.core.config();
should.equal(firebase.app().options.apiKey, platformAppConfig.apiKey);
should.equal(firebase.app().options.appId, platformAppConfig.appId);
should.equal(
firebase.app().options.databaseURL,
platformAppConfig.databaseURL
);
should.equal(
firebase.app().options.messagingSenderId,
platformAppConfig.messagingSenderId
);
should.equal(
firebase.app().options.projectId,
platformAppConfig.projectId
);
should.equal(
firebase.app().options.storageBucket,
platformAppConfig.storageBucket
);
return Promise.resolve();
});
it('it should resolve onReady for natively initialized apps', () =>
firebase.app().onReady());
it('it should initialize dynamic apps', () => {
const name = `testscoreapp${global.testRunId}`;
const platformAppConfig = TestHelpers.core.config();
return firebase
.initializeApp(platformAppConfig, name)
.onReady()
.then(newApp => {
newApp.name.should.equal(name.toUpperCase());
newApp.toString().should.equal(name.toUpperCase());
newApp.options.apiKey.should.equal(platformAppConfig.apiKey);
// TODO add back in when android sdk support for deleting apps becomes available
// return newApp.delete();
return Promise.resolve();
});
});
it('SDK_VERSION should return a string version', () => {
firebase.SDK_VERSION.should.be.a.String();
});
});
describe('App', () => {
it('apps should provide an array of apps', () => {
should.equal(!!firebase.apps.length, true);
should.equal(firebase.apps.includes(firebase.app('[DEFAULT]')), true);
return Promise.resolve();
});
it('delete is unsupported', () => {
(() => {
firebase.app().delete();
}).should.throw(
'app.delete() is unsupported by the native Firebase SDKs.'
);
});
it('extendApp should error if an object is not supplied', () => {
(() => {
firebase.app().extendApp('string');
}).should.throw(
"Missing required argument of type 'Object' for method 'extendApp()'."
);
});
it('extendApp should error if a protected property is supplied', () => {
(() => {
firebase.app().extendApp({
database: {},
});
}).should.throw(
"Property 'database' is protected and can not be overridden by extendApp."
);
});
it('extendApp should provide additional functionality', () => {
const extension = {};
firebase.app().extendApp({
extension,
});
firebase.app().extension.should.equal(extension);
});
});
});

View File

@ -1,78 +0,0 @@
describe('crashlytics()', () => {
// todo test is flakey due to a detox error occurring sometimes;
// Error: the string "Error when sending event: websocketFailed with body:
// {\n id = 0;\n message = \"The operation couldn\\U2019t be completed.
// Connection refused\";\n}. Bridge is not set. This is probably because you've
// explicitly synthesized the bridge in RCTWebSocketModule, even though it's
// inherited from RCTEventEmitter.
xdescribe('crash()', () => {
it('should force an app crash', async () => {
await firebase.crashlytics().crash();
if (device.getPlatform() === 'ios') {
// ios responds quicker after a fatal exception if we re-install
await device.uninstallApp();
await device.installApp();
}
await device.launchApp({ newInstance: true });
await firebase.crashlytics().log('app relaunched from a crash');
});
});
describe('log()', () => {
it('should set a string value', async () => {
await firebase.crashlytics().log('123abc');
});
xit('should error on a non a string value', async () => {
// TODO lib needs validations adding
await firebase.crashlytics().log(123456);
});
});
describe('recordError()', () => {
it('should record an error with a code and message', async () => {
await firebase.crashlytics().recordError(1234, 'Test error');
});
xit('should error on invalid args', async () => {
// TODO lib needs validations adding - and this should technically take an instance of Error only
await firebase.crashlytics().recordError({}, []);
});
});
describe('setBoolValue()', () => {
it('should set a boolean value', async () => {
await firebase.crashlytics().setBoolValue('boolKey', true);
});
});
describe('setFloatValue()', () => {
it('should set a float value', async () => {
await firebase.crashlytics().setFloatValue('floatKey', 1.23);
});
});
describe('setIntValue()', () => {
it('should set a integer value', async () => {
await firebase.crashlytics().setIntValue('intKey', 123);
});
});
describe('setStringValue()', () => {
it('should set a string value', async () => {
await firebase.crashlytics().setStringValue('stringKey', 'test');
});
});
describe('setUserIdentifier()', () => {
it('should set a string value', async () => {
await firebase.crashlytics().setUserIdentifier('123abc');
});
xit('should error on a non a string value', async () => {
// TODO lib needs validations adding
await firebase.crashlytics().setUserIdentifier(123456);
});
});
});

View File

@ -1,46 +0,0 @@
const { CONTENTS, setDatabaseContents } = TestHelpers.database;
describe('database()', () => {
before(() => setDatabaseContents());
describe('ref().once()', () => {
it('returns a promise', () => {
const ref = firebase.database().ref('tests/types/number');
const returnValue = ref.once('value');
returnValue.should.be.Promise();
});
it('resolves with the correct value', async () => {
await Promise.all(
Object.keys(CONTENTS.DEFAULT).map(dataRef => {
const dataTypeValue = CONTENTS.DEFAULT[dataRef];
const ref = firebase.database().ref(`tests/types/${dataRef}`);
return ref.once('value').then(snapshot => {
snapshot.val().should.eql(bridge.contextify(dataTypeValue));
});
})
);
});
it('is NOT called when the value is changed', async () => {
const callback = sinon.spy();
const ref = firebase.database().ref('tests/types/number');
ref.once('value').then(callback);
await ref.set(CONTENTS.NEW.number);
callback.should.be.calledOnce();
});
it('errors if permission denied', async () => {
const reference = firebase.database().ref('nope');
try {
await reference.once('value');
} catch (error) {
error.code.includes('database/permission-denied').should.be.true();
return true;
}
throw new Error('No permission denied error');
});
});
});

View File

@ -1,52 +0,0 @@
const { setDatabaseContents, CONTENTS } = TestHelpers.database;
describe('database()', () => {
beforeEach(() => setDatabaseContents());
describe('ref.set()', () => {
it('returns a promise', async () => {
const ref = firebase.database().ref('tests/types/number');
const returnValue = ref.set(CONTENTS.DEFAULT.number);
returnValue.should.be.Promise();
const value = await returnValue;
(value === null).should.be.true();
});
it('changes value', async () => {
await Promise.all(
Object.keys(CONTENTS.DEFAULT).map(async dataRef => {
const previousValue = bridge.contextify(CONTENTS.DEFAULT[dataRef]);
const ref = firebase.database().ref(`tests/types/${dataRef}`);
const snapshot = await ref.once('value');
snapshot.val().should.eql(previousValue);
const newValue = bridge.contextify(CONTENTS.NEW[dataRef]);
await ref.set(newValue);
const snapshot2 = await ref.once('value');
snapshot2.val().should.eql(newValue);
})
);
});
it('can unset values', async () => {
await Promise.all(
Object.keys(CONTENTS.DEFAULT).map(async dataRef => {
const previousValue = bridge.contextify(CONTENTS.DEFAULT[dataRef]);
const ref = firebase.database().ref(`tests/types/${dataRef}`);
const snapshot = await ref.once('value');
snapshot.val().should.eql(previousValue);
await ref.set(null);
const snapshot2 = await ref.once('value');
(snapshot2.val() === null).should.be.true();
})
);
});
});
});

View File

@ -1,104 +0,0 @@
const { setDatabaseContents } = TestHelpers.database;
// TODO use testRunId in refs to prevent multiple test instances interfering with each other
describe('database()', () => {
describe('Snapshot', () => {
before(() => setDatabaseContents());
it('should provide a functioning val() method', async () => {
const snapshot = await firebase
.database()
.ref('tests/types/array')
.once('value');
snapshot.val.should.be.a.Function();
snapshot.val().should.eql(bridge.Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]));
});
it('should provide a functioning child() method', async () => {
const snapshot = await firebase
.database()
.ref('tests/types/array')
.once('value');
snapshot.child('0').val.should.be.a.Function();
snapshot
.child('0')
.val()
.should.equal(0);
snapshot.child('0').key.should.be.a.String();
snapshot.child('0').key.should.equal('0');
});
// TODO refactor
it('should provide a functioning hasChild() method', async () => {
const snapshot = await firebase
.database()
.ref('tests/types/object')
.once('value');
snapshot.hasChild.should.be.a.Function();
snapshot.hasChild('foo').should.equal(true);
snapshot.hasChild('baz').should.equal(false);
});
it('should provide a functioning hasChildren() method', async () => {
const snapshot = await firebase
.database()
.ref('tests/types/object')
.once('value');
snapshot.hasChildren.should.be.a.Function();
snapshot.hasChildren().should.equal(true);
snapshot
.child('foo')
.hasChildren()
.should.equal(false);
});
it('should provide a functioning exists() method', async () => {
const snapshot = await firebase
.database()
.ref('tests/types/object/baz/daz')
.once('value');
snapshot.exists.should.be.a.Function();
snapshot.exists().should.equal(false);
});
it('should provide a functioning getPriority() method', async () => {
const ref = firebase.database().ref('tests/priority');
const snapshot = await ref.once('value');
snapshot.getPriority.should.be.a.Function();
snapshot.getPriority().should.equal(666);
snapshot.val().should.eql(bridge.Object({ foo: 'bar' }));
});
it('should provide a functioning forEach() method', async () => {
const snapshot = await firebase
.database()
.ref('tests/types/array')
.once('value');
let total = 0;
snapshot.forEach.should.be.a.Function();
snapshot.forEach(childSnapshot => {
const val = childSnapshot.val();
total += val;
return val === 3; // stop iteration after key 3
});
total.should.equal(6); // 0 + 1 + 2 + 3 = 6
});
it('should provide a key property', async () => {
const snapshot = await firebase
.database()
.ref('tests/types/array')
.once('value');
snapshot.key.should.be.a.String();
snapshot.key.should.equal('array');
});
});
});

View File

@ -1,34 +0,0 @@
const { setDatabaseContents } = TestHelpers.database;
// TODO use testRunId in refs to prevent multiple test instances interfering with each other
describe('database()', () => {
before(() => setDatabaseContents());
describe('ref.transaction()', () => {
it('increments a value', async () => {
let valueBefore = 1;
const ref = firebase.database().ref('tests/transaction');
const { committed, snapshot } = await ref.transaction(currentData => {
if (currentData === null) {
return valueBefore + 10;
}
valueBefore = currentData;
return valueBefore + 10;
}, true);
should.equal(committed, true, 'Transaction did not commit.');
snapshot.val().should.equal(valueBefore + 10);
});
it('aborts if undefined returned', async () => {
const ref = firebase.database().ref('tests/transaction');
const { committed } = await ref.transaction(() => undefined, true);
should.equal(
committed,
false,
'Transaction committed and did not abort.'
);
});
});
});

View File

@ -1,79 +0,0 @@
const { testDocRef } = TestHelpers.firestore;
describe('firestore()', () => {
describe('batch()', () => {
it('should create / update / delete', async () => {
const ayRef = testDocRef('AY');
const lRef = testDocRef('LON');
const nycRef = testDocRef('NYC');
const sfRef = testDocRef('SF');
const batch = firebase.firestore().batch();
batch.set(ayRef, { name: 'Aylesbury' });
batch.set(lRef, { name: 'London' });
batch.set(nycRef, { name: 'New York City' });
batch.set(sfRef, { name: 'San Francisco' });
batch.update(nycRef, { population: 1000000 });
batch.update(sfRef, 'name', 'San Fran');
batch.update(
sfRef,
new firebase.firestore.FieldPath('name'),
'San Fran FieldPath'
);
batch.update(
sfRef,
new firebase.firestore.FieldPath('nested', 'name'),
'Nested Nme'
);
batch.update(
sfRef,
new firebase.firestore.FieldPath('nested', 'firstname'),
'First Name',
new firebase.firestore.FieldPath('nested', 'lastname'),
'Last Name'
);
batch.set(lRef, { population: 3000000 }, { merge: true });
batch.delete(ayRef);
await batch.commit();
const ayDoc = await ayRef.get();
should.equal(ayDoc.exists, false);
const lDoc = await lRef.get();
lDoc.data().name.should.equal('London');
lDoc.data().population.should.equal(3000000);
const nycDoc = await nycRef.get();
nycDoc.data().name.should.equal('New York City');
nycDoc.data().population.should.equal(1000000);
const sfDoc = await sfRef.get();
sfDoc.data().name.should.equal('San Fran FieldPath');
sfDoc.data().nested.firstname.should.equal('First Name');
sfDoc.data().nested.lastname.should.equal('Last Name');
});
it('errors when invalid parameters supplied', async () => {
const ref = firebase.firestore().doc('collection/doc');
const batch = firebase.firestore().batch();
(() => {
batch.update(ref, 'error');
}).should.throw(
'WriteBatch.update failed: If using a single update argument, it must be an object.'
);
(() => {
batch.update(ref, 'error1', 'error2', 'error3');
}).should.throw(
'WriteBatch.update failed: The update arguments must be either a single object argument, or equal numbers of key/value pairs.'
);
(() => {
batch.update(ref, 0, 'error');
}).should.throw(
'WriteBatch.update failed: Argument at index 0 must be a string or FieldPath'
);
});
});
});

View File

@ -1,156 +0,0 @@
const testObject = { hello: 'world', testRunId };
const testString = JSON.stringify(testObject);
const testBuffer = Buffer.from(testString);
const testBase64 = testBuffer.toString('base64');
const testObjectLarge = new Array(5000).fill(testObject);
const testStringLarge = JSON.stringify(testObjectLarge);
const testBufferLarge = Buffer.from(testStringLarge);
const testBase64Large = testBufferLarge.toString('base64');
/** ----------------
* CLASS TESTS
* -----------------*/
describe('firestore', () => {
it('should export Blob class on statics', async () => {
const { Blob } = firebase.firestore;
should.exist(Blob);
});
describe('Blob', () => {
it('.constructor() -> returns new instance of Blob', async () => {
const { Blob } = firebase.firestore;
const myBlob = new Blob(testStringLarge);
myBlob.should.be.instanceOf(Blob);
myBlob._binaryString.should.equal(testStringLarge);
myBlob.toBase64().should.equal(testBase64Large);
});
it('.fromBase64String() -> returns new instance of Blob', async () => {
const { Blob } = firebase.firestore;
const myBlob = Blob.fromBase64String(testBase64);
myBlob.should.be.instanceOf(Blob);
myBlob._binaryString.should.equal(testString);
should.deepEqual(
JSON.parse(myBlob._binaryString),
testObject,
'Expected Blob _binaryString internals to serialize to json and match test object'
);
});
it('.fromBase64String() -> throws if arg not typeof string and length > 0', async () => {
const { Blob } = firebase.firestore;
const myBlob = Blob.fromBase64String(testBase64);
myBlob.should.be.instanceOf(Blob);
(() => Blob.fromBase64String(1234)).should.throwError();
(() => Blob.fromBase64String('')).should.throwError();
});
it('.fromUint8Array() -> returns new instance of Blob', async () => {
const testUInt8Array = new Uint8Array(testBuffer);
const { Blob } = firebase.firestore;
const myBlob = Blob.fromUint8Array(testUInt8Array);
myBlob.should.be.instanceOf(Blob);
const json = JSON.parse(myBlob._binaryString);
json.hello.should.equal('world');
});
it('.fromUint8Array() -> throws if arg not instanceof Uint8Array', async () => {
const testUInt8Array = new Uint8Array(testBuffer);
const { Blob } = firebase.firestore;
const myBlob = Blob.fromUint8Array(testUInt8Array);
myBlob.should.be.instanceOf(Blob);
(() => Blob.fromUint8Array('derp')).should.throwError();
});
});
describe('Blob instance', () => {
it('.toString() -> returns string representation of blob instance', async () => {
const { Blob } = firebase.firestore;
const myBlob = Blob.fromBase64String(testBase64);
myBlob.should.be.instanceOf(Blob);
should.equal(
myBlob.toString().includes(testBase64),
true,
'toString() should return a string that includes the base64'
);
});
it('.isEqual() -> returns true or false', async () => {
const { Blob } = firebase.firestore;
const myBlob = Blob.fromBase64String(testBase64);
const myBlob2 = Blob.fromBase64String(testBase64Large);
myBlob.isEqual(myBlob).should.equal(true);
myBlob2.isEqual(myBlob).should.equal(false);
});
it('.isEqual() -> throws if arg not instanceof Blob', async () => {
const { Blob } = firebase.firestore;
const myBlob = Blob.fromBase64String(testBase64);
const myBlob2 = Blob.fromBase64String(testBase64Large);
myBlob.isEqual(myBlob).should.equal(true);
(() => myBlob2.isEqual('derp')).should.throwError();
});
it('.toBase64() -> returns base64 string', async () => {
const { Blob } = firebase.firestore;
const myBlob = Blob.fromBase64String(testBase64);
myBlob.should.be.instanceOf(Blob);
myBlob.toBase64().should.equal(testBase64);
});
it('.toUint8Array() -> returns Uint8Array', async () => {
const { Blob } = firebase.firestore;
const myBlob = Blob.fromBase64String(testBase64);
const testUInt8Array = new Uint8Array(testBuffer);
const testUInt8Array2 = new Uint8Array();
myBlob.should.be.instanceOf(Blob);
should.deepEqual(myBlob.toUint8Array(), testUInt8Array);
should.notDeepEqual(myBlob.toUint8Array(), testUInt8Array2);
});
});
});
/** ----------------
* USAGE TESTS
* -----------------*/
describe('firestore', () => {
describe('Blob', () => {
it('reads and writes small blobs', async () => {
const { Blob } = firebase.firestore;
await firebase
.firestore()
.doc('blob-tests/small')
.set({ blobby: Blob.fromBase64String(testBase64) });
const snapshot = await firebase
.firestore()
.doc('blob-tests/small')
.get();
const blob = snapshot.data().blobby;
blob._binaryString.should.equal(testString);
blob.toBase64().should.equal(testBase64);
});
it('reads and writes large blobs', async () => {
const { Blob } = firebase.firestore;
await firebase
.firestore()
.doc('blob-tests/large')
.set({ blobby: Blob.fromBase64String(testBase64Large) });
const snapshot = await firebase
.firestore()
.doc('blob-tests/large')
.get();
const blob = snapshot.data().blobby;
blob._binaryString.should.equal(testStringLarge);
blob.toBase64().should.equal(testBase64Large);
});
});
});

File diff suppressed because it is too large Load Diff

View File

@ -1,658 +0,0 @@
const {
test2DocRef,
COL2_DOC_1,
COL2_DOC_1_ID,
COL2_DOC_1_PATH,
TEST2_COLLECTION_NAME,
resetTestCollectionDoc,
} = TestHelpers.firestore;
describe('firestore()', () => {
describe('DocumentReference', () => {
before(async () => {
await resetTestCollectionDoc(COL2_DOC_1_PATH, COL2_DOC_1());
});
describe('class', () => {
it('should return instance methods', () => {
const document = test2DocRef(COL2_DOC_1_ID);
document.should.have.property('firestore');
// TODO: Remaining checks
});
});
describe('id', () => {
it('should return document id', () => {
const document = test2DocRef(COL2_DOC_1_ID);
document.id.should.equal(COL2_DOC_1_ID);
});
});
describe('parent', () => {
it('should return parent collection', () => {
const document = test2DocRef(COL2_DOC_1_ID);
document.parent.id.should.equal(TEST2_COLLECTION_NAME);
});
});
describe('collection()', () => {
it('should return a child collection', () => {
const document = test2DocRef(COL2_DOC_1_ID);
const collection = document.collection('pages');
collection.id.should.equal('pages');
});
it('should error if invalid collection path supplied', () => {
(() => {
test2DocRef(COL2_DOC_1_ID).collection('pages/page1');
}).should.throw(
'Argument "collectionPath" must point to a collection.'
);
});
});
describe('delete()', () => {
it('should delete Document', async () => {
await resetTestCollectionDoc(COL2_DOC_1_PATH, COL2_DOC_1());
await test2DocRef(COL2_DOC_1_ID).delete();
const doc = await test2DocRef(COL2_DOC_1_ID).get();
should.equal(doc.exists, false);
});
});
describe('get()', () => {
it('DocumentSnapshot should have correct properties', async () => {
await resetTestCollectionDoc(COL2_DOC_1_PATH, COL2_DOC_1());
const snapshot = await test2DocRef(COL2_DOC_1_ID).get();
snapshot.id.should.equal(COL2_DOC_1_ID);
snapshot.metadata.should.be.an.Object();
});
it('should support GetOptions source=`default`', async () => {
await resetTestCollectionDoc(COL2_DOC_1_PATH, COL2_DOC_1());
const snapshot = await test2DocRef(COL2_DOC_1_ID).get({
source: 'default',
});
snapshot.id.should.equal(COL2_DOC_1_ID);
snapshot.metadata.should.be.an.Object();
should.equal(snapshot.metadata.fromCache, false);
});
it('should support GetOptions source=`server`', async () => {
await resetTestCollectionDoc(COL2_DOC_1_PATH, COL2_DOC_1());
const snapshot = await test2DocRef(COL2_DOC_1_ID).get({
source: 'server',
});
snapshot.id.should.equal(COL2_DOC_1_ID);
snapshot.metadata.should.be.an.Object();
should.equal(snapshot.metadata.fromCache, false);
});
// TODO: For some reason when using `cache` it's not seeing the data as available, even if
// first requesting it from the server, although interestingly it works fine in the old
// tests app
xit('should support GetOptions source=`cache`', async () => {
await resetTestCollectionDoc(COL2_DOC_1_PATH, COL2_DOC_1());
const ref = test2DocRef(COL2_DOC_1_ID);
// Make sure the reference data is populated in the cache
await ref.get({ source: 'server' });
// Retrieve the cached version
const snapshot = await ref.get({ source: 'cache' });
snapshot.id.should.equal(COL2_DOC_1_ID);
snapshot.metadata.should.be.an.Object();
should.equal(snapshot.metadata.fromCache, true);
});
it('should error with invalid GetOptions source option', async () => {
const docRef = test2DocRef(COL2_DOC_1_ID);
try {
await docRef.get(() => {});
return Promise.reject(
new Error('get() did not reject with invalid argument.')
);
} catch (e) {
// do nothing
}
try {
await docRef.get({ source: 'invalid' });
return Promise.reject(
new Error('get() did not reject with invalid source property.')
);
} catch (e) {
// do nothing
}
return Promise.resolve();
});
});
describe('onSnapshot()', () => {
it('calls callback with the initial data and then when value changes', async () => {
await resetTestCollectionDoc(COL2_DOC_1_PATH, { name: 'doc1' });
const docRef = test2DocRef(COL2_DOC_1_ID);
const currentDataValue = { name: 'doc1' };
const newDataValue = { name: 'updated' };
const callback = sinon.spy();
// Test
let unsubscribe;
await new Promise(resolve2 => {
unsubscribe = docRef.onSnapshot(snapshot => {
callback(snapshot.data());
resolve2();
});
});
callback.should.be.calledWith(currentDataValue);
// Update the document
await docRef.set(newDataValue);
await sleep(50);
// Assertions
callback.should.be.calledWith(newDataValue);
callback.should.be.calledTwice();
// Tear down
unsubscribe();
});
it("doesn't call callback when the ref is updated with the same value", async () => {
await resetTestCollectionDoc(COL2_DOC_1_PATH, { name: 'doc1' });
const docRef = test2DocRef(COL2_DOC_1_ID);
const currentDataValue = { name: 'doc1' };
const callback = sinon.spy();
// Test
let unsubscribe;
await new Promise(resolve2 => {
unsubscribe = docRef.onSnapshot(snapshot => {
callback(snapshot.data());
resolve2();
});
});
callback.should.be.calledWith(currentDataValue);
await docRef.set(currentDataValue);
await sleep(50);
// Assertions
callback.should.be.calledOnce(); // Callback is not called again
// Tear down
unsubscribe();
});
it('allows binding multiple callbacks to the same ref', async () => {
// Setup
await resetTestCollectionDoc(COL2_DOC_1_PATH, { name: 'doc1' });
const docRef = test2DocRef(COL2_DOC_1_ID);
const currentDataValue = { name: 'doc1' };
const newDataValue = { name: 'updated' };
const callbackA = sinon.spy();
const callbackB = sinon.spy();
// Test
let unsubscribeA;
let unsubscribeB;
await new Promise(resolve2 => {
unsubscribeA = docRef.onSnapshot(snapshot => {
callbackA(snapshot.data());
resolve2();
});
});
await new Promise(resolve2 => {
unsubscribeB = docRef.onSnapshot(snapshot => {
callbackB(snapshot.data());
resolve2();
});
});
callbackA.should.be.calledWith(currentDataValue);
callbackA.should.be.calledOnce();
callbackB.should.be.calledWith(currentDataValue);
callbackB.should.be.calledOnce();
await docRef.set(newDataValue);
await sleep(50);
callbackA.should.be.calledWith(newDataValue);
callbackB.should.be.calledWith(newDataValue);
callbackA.should.be.calledTwice();
callbackB.should.be.calledTwice();
// Tear down
unsubscribeA();
unsubscribeB();
});
it('listener stops listening when unsubscribed', async () => {
await resetTestCollectionDoc(COL2_DOC_1_PATH, { name: 'doc1' });
// Setup
const docRef = test2DocRef(COL2_DOC_1_ID);
const currentDataValue = { name: 'doc1' };
const newDataValue = { name: 'updated' };
const callbackA = sinon.spy();
const callbackB = sinon.spy();
// Test
let unsubscribeA;
let unsubscribeB;
await new Promise(resolve2 => {
unsubscribeA = docRef.onSnapshot(snapshot => {
callbackA(snapshot.data());
resolve2();
});
});
await new Promise(resolve2 => {
unsubscribeB = docRef.onSnapshot(snapshot => {
callbackB(snapshot.data());
resolve2();
});
});
callbackA.should.be.calledWith(currentDataValue);
callbackA.should.be.calledOnce();
callbackB.should.be.calledWith(currentDataValue);
callbackB.should.be.calledOnce();
await docRef.set(newDataValue);
await sleep(50);
callbackA.should.be.calledWith(newDataValue);
callbackB.should.be.calledWith(newDataValue);
callbackA.should.be.calledTwice();
callbackB.should.be.calledTwice();
// Unsubscribe A
unsubscribeA();
await docRef.set(currentDataValue);
await sleep(50);
callbackB.should.be.calledWith(currentDataValue);
callbackA.should.be.calledTwice();
callbackB.should.be.calledThrice();
// Unsubscribe B
unsubscribeB();
await docRef.set(newDataValue);
await sleep(50);
callbackA.should.be.calledTwice();
callbackB.should.be.calledThrice();
});
it('supports options and callbacks', async () => {
await resetTestCollectionDoc(COL2_DOC_1_PATH, { name: 'doc1' });
const docRef = test2DocRef(COL2_DOC_1_ID);
const currentDataValue = { name: 'doc1' };
const newDataValue = { name: 'updated' };
const callback = sinon.spy();
// Test
let unsubscribe;
await new Promise(resolve2 => {
unsubscribe = docRef.onSnapshot(
{ includeMetadataChanges: true },
snapshot => {
callback(snapshot.data());
resolve2();
}
);
});
callback.should.be.calledWith(currentDataValue);
// Update the document
await docRef.set(newDataValue);
await sleep(50);
// Assertions
callback.should.be.calledWith(newDataValue);
// Tear down
unsubscribe();
});
it('supports observer', async () => {
await resetTestCollectionDoc(COL2_DOC_1_PATH, { name: 'doc1' });
const docRef = test2DocRef(COL2_DOC_1_ID);
const currentDataValue = { name: 'doc1' };
const newDataValue = { name: 'updated' };
const callback = sinon.spy();
// Test
let unsubscribe;
await new Promise(resolve2 => {
const observer = {
next: snapshot => {
callback(snapshot.data());
resolve2();
},
};
unsubscribe = docRef.onSnapshot(observer);
});
callback.should.be.calledWith(currentDataValue);
// Update the document
await docRef.set(newDataValue);
await sleep(50);
// Assertions
callback.should.be.calledWith(newDataValue);
callback.should.be.calledTwice();
// Tear down
unsubscribe();
});
it('supports options and observer', async () => {
await resetTestCollectionDoc(COL2_DOC_1_PATH, { name: 'doc1' });
const docRef = test2DocRef(COL2_DOC_1_ID);
const currentDataValue = { name: 'doc1' };
const newDataValue = { name: 'updated' };
const callback = sinon.spy();
// Test
let unsubscribe;
await new Promise(resolve2 => {
const observer = {
next: snapshot => {
callback(snapshot.data());
resolve2();
},
error: () => {},
};
unsubscribe = docRef.onSnapshot(
{ includeMetadataChanges: true },
observer
);
});
callback.should.be.calledWith(currentDataValue);
// Update the document
await docRef.set(newDataValue);
await sleep(50);
// Assertions
callback.should.be.calledWith(newDataValue);
// Tear down
unsubscribe();
});
it('errors when invalid parameters supplied', async () => {
const docRef = test2DocRef(COL2_DOC_1_ID);
(() => {
docRef.onSnapshot(() => {}, 'error');
}).should.throw(
'DocumentReference.onSnapshot failed: Second argument must be a valid function.'
);
(() => {
docRef.onSnapshot({
next: () => {},
error: 'error',
});
}).should.throw(
'DocumentReference.onSnapshot failed: Observer.error must be a valid function.'
);
(() => {
docRef.onSnapshot({
next: 'error',
});
}).should.throw(
'DocumentReference.onSnapshot failed: Observer.next must be a valid function.'
);
(() => {
docRef.onSnapshot(
{
includeMetadataChanges: true,
},
() => {},
'error'
);
}).should.throw(
'DocumentReference.onSnapshot failed: Third argument must be a valid function.'
);
(() => {
docRef.onSnapshot(
{
includeMetadataChanges: true,
},
{
next: () => {},
error: 'error',
}
);
}).should.throw(
'DocumentReference.onSnapshot failed: Observer.error must be a valid function.'
);
(() => {
docRef.onSnapshot(
{
includeMetadataChanges: true,
},
{
next: 'error',
}
);
}).should.throw(
'DocumentReference.onSnapshot failed: Observer.next must be a valid function.'
);
(() => {
docRef.onSnapshot(
{
includeMetadataChanges: true,
},
'error'
);
}).should.throw(
'DocumentReference.onSnapshot failed: Second argument must be a function or observer.'
);
(() => {
docRef.onSnapshot({
error: 'error',
});
}).should.throw(
'DocumentReference.onSnapshot failed: First argument must be a function, observer or options.'
);
(() => {
docRef.onSnapshot();
}).should.throw(
'DocumentReference.onSnapshot failed: Called with invalid arguments.'
);
});
});
describe('set()', () => {
before(async () => {
await resetTestCollectionDoc(COL2_DOC_1_PATH, { name: 'doc1' });
});
it('should create Document', async () => {
await test2DocRef('doc2').set({ name: 'doc2', testArray: [] });
const doc = await test2DocRef('doc2').get();
doc.data().name.should.equal('doc2');
});
it('should merge Document', async () => {
await test2DocRef(COL2_DOC_1_ID).set(
{ merge: 'merge' },
{ merge: true }
);
const doc = await test2DocRef(COL2_DOC_1_ID).get();
doc.data().name.should.equal('doc1');
doc.data().merge.should.equal('merge');
});
it('should overwrite Document', async () => {
await test2DocRef(COL2_DOC_1_ID).set({ name: 'overwritten' });
const doc = await test2DocRef(COL2_DOC_1_ID).get();
doc.data().name.should.equal('overwritten');
});
});
describe('update()', () => {
beforeEach(async () => {
await resetTestCollectionDoc(COL2_DOC_1_PATH, { name: 'doc1' });
});
it('should update Document using object', async () => {
await test2DocRef(COL2_DOC_1_ID).update({ name: 'updated' });
const doc = await test2DocRef(COL2_DOC_1_ID).get();
doc.data().name.should.equal('updated');
});
it('should update Document using key/value pairs', async () => {
await test2DocRef(COL2_DOC_1_ID).update('name', 'updated');
const doc = await test2DocRef(COL2_DOC_1_ID).get();
doc.data().name.should.equal('updated');
});
it('should update Document using FieldPath/value pair', async () => {
await test2DocRef(COL2_DOC_1_ID).update(
new firebase.firestore.FieldPath('name'),
'Name'
);
const doc = await test2DocRef(COL2_DOC_1_ID).get();
doc.data().name.should.equal('Name');
});
it('should update Document using nested FieldPath and value pair', async () => {
await test2DocRef(COL2_DOC_1_ID).update(
new firebase.firestore.FieldPath('nested', 'name'),
'Nested Name'
);
const doc = await test2DocRef(COL2_DOC_1_ID).get();
doc.data().nested.name.should.equal('Nested Name');
});
it('should update Document using multiple FieldPath/value pairs', async () => {
await test2DocRef(COL2_DOC_1_ID).update(
new firebase.firestore.FieldPath('nested', 'firstname'),
'First Name',
new firebase.firestore.FieldPath('nested', 'lastname'),
'Last Name'
);
const doc = await test2DocRef(COL2_DOC_1_ID).get();
doc.data().nested.firstname.should.equal('First Name');
doc.data().nested.lastname.should.equal('Last Name');
});
it('errors when invalid parameters supplied', async () => {
const docRef = test2DocRef(COL2_DOC_1_ID);
(() => {
docRef.update('error');
}).should.throw(
'DocumentReference.update failed: If using a single update argument, it must be an object.'
);
(() => {
docRef.update('error1', 'error2', 'error3');
}).should.throw(
'DocumentReference.update failed: The update arguments must be either a single object argument, or equal numbers of key/value pairs.'
);
(() => {
docRef.update(0, 'error');
}).should.throw(
'DocumentReference.update failed: Argument at index 0 must be a string or FieldPath'
);
});
});
describe('types', () => {
it('should handle Boolean field', async () => {
const docRef = test2DocRef('reference');
await docRef.set({
field: true,
});
const doc = await docRef.get();
should.equal(doc.data().field, true);
});
it('should handle Date field', async () => {
const date = new bridge.context.window.Date();
const docRef = test2DocRef('reference');
await docRef.set({
field: date,
});
const doc = await docRef.get();
doc.data().field.should.be.instanceof(bridge.context.window.Date);
should.equal(doc.data().field.toISOString(), date.toISOString());
should.equal(doc.data().field.getTime(), date.getTime());
});
it('should handle DocumentReference field', async () => {
const docRef = test2DocRef('reference');
await docRef.set({
field: firebase.firestore().doc('test/field'),
});
const doc = await docRef.get();
should.equal(doc.data().field.path, 'test/field');
});
it('should handle GeoPoint field', async () => {
const docRef = test2DocRef('reference');
await docRef.set({
field: new firebase.firestore.GeoPoint(1.01, 1.02),
});
const doc = await docRef.get();
should.equal(doc.data().field.latitude, 1.01);
should.equal(doc.data().field.longitude, 1.02);
});
});
});
});

View File

@ -1,109 +0,0 @@
const {
COL_DOC_1,
COL_DOC_1_ID,
COL_DOC_1_PATH,
testCollectionDoc,
resetTestCollectionDoc,
} = TestHelpers.firestore;
describe('firestore()', () => {
describe('DocumentSnapshot', () => {
before(async () => {
await resetTestCollectionDoc(COL_DOC_1_PATH, COL_DOC_1());
});
describe('id', () => {
it('returns a string document id', async () => {
const snapshot = await testCollectionDoc(COL_DOC_1_PATH).get();
snapshot.id.should.be.a.String();
snapshot.id.should.equal(COL_DOC_1_ID);
});
});
describe('ref', () => {
it('returns a DocumentReference', async () => {
const snapshot = await testCollectionDoc(COL_DOC_1_PATH).get();
const DocumentReference = bridge.require(
'dist/modules/firestore/DocumentReference'
);
snapshot.ref.should.be.an.instanceOf(DocumentReference);
});
});
describe('metadata', () => {
it('returns an object of meta data', async () => {
const { metadata } = await testCollectionDoc(COL_DOC_1_PATH).get();
metadata.should.be.an.Object();
metadata.should.have.property('hasPendingWrites');
metadata.should.have.property('fromCache');
metadata.hasPendingWrites.should.be.a.Boolean();
metadata.fromCache.should.be.a.Boolean();
});
});
describe('exists', () => {
it('returns a boolean', async () => {
const { exists } = await testCollectionDoc(COL_DOC_1_PATH).get();
exists.should.be.a.Boolean();
exists.should.be.true();
});
});
describe('data()', () => {
it('returns document data', async () => {
// additionally tests context binding not lost during destructuring
const snapshot = await testCollectionDoc(COL_DOC_1_PATH).get();
const { data } = snapshot;
snapshot.data.should.be.a.Function();
data.should.be.a.Function();
snapshot.data().should.be.a.Object();
data().should.be.a.Object();
snapshot.data().baz.should.be.true();
data().baz.should.be.true();
});
});
describe('get()', () => {
it('using a dot notated path string', async () => {
// additionally tests context binding not lost during destructuring
const snapshot = await testCollectionDoc(COL_DOC_1_PATH).get();
const { get } = snapshot;
should.equal(snapshot.get('foo'), 'bar');
should.equal(get('foo'), 'bar');
should.equal(snapshot.get('object.daz'), 123);
should.equal(get('object.daz'), 123);
should.equal(snapshot.get('nonexistent.object'), undefined);
should.equal(get('nonexistent.object'), undefined);
});
it('using a FieldPath instance', async () => {
const snapshot = await testCollectionDoc(COL_DOC_1_PATH).get();
should.equal(snapshot.get('foo'), 'bar');
should.equal(
snapshot.get(new firebase.firestore.FieldPath('foo')),
'bar'
);
should.equal(
snapshot.get(new firebase.firestore.FieldPath('object', 'daz')),
123
);
should.equal(
snapshot.get(
new firebase.firestore.FieldPath('nonexistent', 'object')
),
undefined
);
});
});
});
});

View File

@ -1,40 +0,0 @@
const {
COL_DOC_1,
COL_DOC_1_PATH,
testCollectionDoc,
resetTestCollectionDoc,
} = TestHelpers.firestore;
describe('firestore()', () => {
describe('FieldPath', () => {
before(async () => {
await resetTestCollectionDoc(COL_DOC_1_PATH, COL_DOC_1());
});
it('documentId() should return a FieldPath', () => {
const documentId = firebase.firestore.FieldPath.documentId();
documentId.should.be.instanceof(firebase.firestore.FieldPath);
});
it('should allow getting values via documentSnapshot.get(FieldPath)', async () => {
const snapshot = await testCollectionDoc(COL_DOC_1_PATH).get();
should.equal(snapshot.get('foo'), 'bar');
should.equal(
snapshot.get(new firebase.firestore.FieldPath('foo')),
'bar'
);
should.equal(
snapshot.get(new firebase.firestore.FieldPath('object', 'daz')),
123
);
should.equal(
snapshot.get(new firebase.firestore.FieldPath('nonexistent', 'object')),
undefined
);
});
});
});

View File

@ -1,50 +0,0 @@
const {
DOC_2,
DOC_2_PATH,
testCollectionDoc,
resetTestCollectionDoc,
} = TestHelpers.firestore;
describe('firestore()', () => {
describe('FieldValue', () => {
before(async () => {
await resetTestCollectionDoc(DOC_2_PATH, DOC_2);
});
describe('delete()', () => {
it('should delete a field', async () => {
const { data } = await testCollectionDoc(DOC_2_PATH).get();
should.equal(data().title, DOC_2.title);
await testCollectionDoc(DOC_2_PATH).update({
title: firebase.firestore.FieldValue.delete(),
});
const { data: dataAfterUpdate } = await testCollectionDoc(
DOC_2_PATH
).get();
should.equal(dataAfterUpdate().title, undefined);
});
});
describe('serverTimestamp()', () => {
it('should set timestamp', async () => {
const { data } = await testCollectionDoc(DOC_2_PATH).get();
should.equal(data().creationDate, undefined);
await testCollectionDoc(DOC_2_PATH).update({
creationDate: firebase.firestore.FieldValue.serverTimestamp(),
});
const { data: dataAfterUpdate } = await testCollectionDoc(
DOC_2_PATH
).get();
dataAfterUpdate().creationDate.should.be.instanceof(
bridge.context.window.Date
);
});
});
});
});

View File

@ -1,123 +0,0 @@
describe('firestore()', () => {
describe('collection()', () => {
it('should create CollectionReference with the right id', () => {
firebase
.firestore()
.collection('collection1/doc1/collection2')
.id.should.equal('collection2');
});
it('should error if invalid collection path supplied', () => {
(() => {
firebase.firestore().collection('collection1/doc1');
}).should.throw('Argument "collectionPath" must point to a collection.');
});
});
describe('doc()', () => {
it('should create DocumentReference with correct path', () => {
firebase
.firestore()
.doc('collection1/doc1/collection2/doc2')
.path.should.equal('collection1/doc1/collection2/doc2');
});
it('should error if invalid document path supplied', () => {
(() => {
firebase.firestore().doc('collection1');
}).should.throw('Argument "documentPath" must point to a document.');
});
});
describe('disable/enableNetwork()', () => {
it('calls without error', async () => {
await firebase.firestore().disableNetwork();
await firebase.firestore().enableNetwork();
});
});
describe('enablePersistence()', () => {
it('calls without error', async () => {
await firebase.firestore().enablePersistence();
});
});
describe('setLogLevel()', () => {
it('should set level from string', () => {
firebase.firestore.setLogLevel('debug');
firebase.firestore.setLogLevel('error');
firebase.firestore.setLogLevel('silent');
// test deprecated method
firebase.firestore.enableLogging(true);
firebase.firestore.enableLogging(false);
});
it('should throw an invalid parameter error', () => {
(() => {
firebase.firestore.setLogLevel('warn');
}).should.throw(
'Argument `logLevel` must be one of: `debug`, `error`, `silent`'
);
});
});
describe('settings()', () => {
it('should reject invalid object', async () => {
try {
await firebase.firestore().settings('test');
} catch (error) {
return Promise.resolve();
}
return Promise.reject(new Error('Did not error on invalid object'));
});
it('should reject invalid host setting', async () => {
try {
await firebase.firestore().settings({ host: true });
} catch (error) {
return Promise.resolve();
}
return Promise.reject(
new Error('Did not error on invalid `host` setting')
);
});
it('should reject invalid persistence setting', async () => {
try {
await firebase.firestore().settings({ persistence: 'fail' });
} catch (error) {
return Promise.resolve();
}
return Promise.reject(
new Error('Did not error on invalid `persistence` setting')
);
});
it('should reject invalid ssl setting', async () => {
try {
await firebase.firestore().settings({ ssl: 'fail' });
} catch (error) {
return Promise.resolve();
}
return Promise.reject(
new Error('Did not error on invalid `ssl` setting')
);
});
it('should reject invalid timestampsInSnapshots setting', async () => {
try {
await firebase.firestore().settings({ timestampsInSnapshots: 'fail' });
} catch (error) {
return Promise.resolve();
}
return Promise.reject(
new Error('Did not error on invalid `timestampsInSnapshots` setting')
);
});
});
});

View File

@ -1,119 +0,0 @@
describe('firestore()', () => {
describe('Path', () => {
describe('id', () => {
it('returns the document id', async () => {
const Path = bridge.require('dist/modules/firestore/Path');
const path = Path.fromName('collection/documentId');
path.id.should.be.equal('documentId');
});
it('returns null if no path', async () => {
const Path = bridge.require('dist/modules/firestore/Path');
const path = Path.fromName('');
should.equal(path.id, null);
});
});
describe('isDocument', () => {
it('returns true if path is a document', async () => {
const Path = bridge.require('dist/modules/firestore/Path');
const path = Path.fromName('collection/documentId');
path.isDocument.should.be.equal(true);
});
it('returns false if path is a collection', async () => {
const Path = bridge.require('dist/modules/firestore/Path');
const path = Path.fromName('collection');
path.isDocument.should.be.equal(false);
});
});
describe('isCollection', () => {
it('returns true if path is a collection', async () => {
const Path = bridge.require('dist/modules/firestore/Path');
const path = Path.fromName('collection');
path.isCollection.should.be.equal(true);
});
it('returns false if path is a document', async () => {
const Path = bridge.require('dist/modules/firestore/Path');
const path = Path.fromName('collection/documentId');
path.isCollection.should.be.equal(false);
});
});
describe('relativeName', () => {
it('returns original full path', async () => {
const Path = bridge.require('dist/modules/firestore/Path');
const path = Path.fromName('collection');
const path2 = Path.fromName('collection/documentId');
path.relativeName.should.be.equal('collection');
path2.relativeName.should.be.equal('collection/documentId');
});
});
describe('child()', () => {
it('returns original path joined with the provided child path', async () => {
const Path = bridge.require('dist/modules/firestore/Path');
const path = Path.fromName('collection');
const path2 = path.child('documentId');
path.relativeName.should.be.equal('collection');
path2.relativeName.should.be.equal('collection/documentId');
});
});
describe('parent()', () => {
it('returns the parent of the current child path', async () => {
const Path = bridge.require('dist/modules/firestore/Path');
const path = Path.fromName('collection/documentId');
const path2 = path.parent();
path.relativeName.should.be.equal('collection/documentId');
path2.relativeName.should.be.equal('collection');
});
it('returns null if no path', async () => {
const Path = bridge.require('dist/modules/firestore/Path');
const path = Path.fromName('');
const path2 = path.parent();
path._parts.length.should.be.equal(0);
should.equal(path2, null);
});
});
describe('static fromName()', () => {
it('returns a new instance from a / delimited path string', async () => {
const Path = bridge.require('dist/modules/firestore/Path');
const path = Path.fromName('collection/document');
path.should.be.instanceOf(Path);
path._parts.length.should.be.equal(2);
});
it('returns a new instance from an empty string', async () => {
const Path = bridge.require('dist/modules/firestore/Path');
const path = Path.fromName('');
path.should.be.instanceOf(Path);
path._parts.length.should.be.equal(0);
});
});
it('returns a new instance with no args provided', async () => {
const Path = bridge.require('dist/modules/firestore/Path');
const path = Path.fromName();
path.should.be.instanceOf(Path);
path._parts.length.should.be.equal(0);
});
});
});

View File

@ -1,167 +0,0 @@
const { testDocRef } = TestHelpers.firestore;
describe('firestore()', () => {
describe('runTransaction()', () => {
it('should set() values', async () => {
const firestore = firebase.firestore();
const docRef = testDocRef('tSet');
const updateFunction = async transaction => {
const doc = await transaction.get(docRef);
if (!doc.exists) {
transaction.set(docRef, { value: 1, somethingElse: 'set' });
return 1;
}
return 0;
};
const result = await firestore.runTransaction(updateFunction);
should.equal(result, 1);
const finalDoc = await docRef.get();
finalDoc.data().value.should.equal(1);
finalDoc.data().somethingElse.should.equal('set');
});
it('should update() values', async () => {
const firestore = firebase.firestore();
const docRef = testDocRef('tUpdate');
await docRef.set({ value: 1 });
const updateFunction = async transaction => {
const doc = await transaction.get(docRef);
if (doc.exists) {
transaction.update(docRef, {
value: doc.data().value + 1,
somethingElse: 'update',
});
return 1;
}
return 0;
};
const result = await firestore.runTransaction(updateFunction);
should.equal(result, 1);
const finalDoc = await docRef.get();
finalDoc.data().value.should.equal(2);
finalDoc.data().somethingElse.should.equal('update');
});
it('should delete() values', async () => {
const firestore = firebase.firestore();
const docRef = testDocRef('tDelete');
await docRef.set({ value: 1, somethingElse: 'delete' });
const updateFunction = async transaction => {
const doc = await transaction.get(docRef);
if (doc.exists) {
transaction.delete(docRef);
return 1;
}
return 0;
};
const result = await firestore.runTransaction(updateFunction);
should.equal(result, 1);
const finalDoc = await docRef.get();
finalDoc.exists.should.equal(false);
});
it('error if updateFn does return a promise', async () => {
const firestore = firebase.firestore();
// test async functions - they always return a promise in JS
let didReject = false;
let updateFunction = async () => 1;
try {
await firestore.runTransaction(updateFunction);
} catch (e) {
didReject = true;
}
should.equal(didReject, false);
// should not error as a promise returned
didReject = false;
updateFunction = () => Promise.resolve();
try {
await firestore.runTransaction(updateFunction);
} catch (e) {
didReject = true;
}
should.equal(didReject, false);
// should error as no promise returned
didReject = false;
updateFunction = () => '123456';
try {
await firestore.runTransaction(updateFunction);
} catch (e) {
didReject = true;
e.message.includes('must return a Promise');
}
should.equal(didReject, true);
});
it('updateFn promise rejections / js exceptions handled', async () => {
const firestore = firebase.firestore();
// rejections
let didReject = false;
// eslint-disable-next-line
let updateFunction = () => Promise.reject('shoop');
try {
await firestore.runTransaction(updateFunction);
} catch (e) {
didReject = true;
should.equal(e, 'shoop');
}
should.equal(didReject, true);
// exceptions
didReject = false;
updateFunction = () => {
// eslint-disable-next-line no-throw-literal
throw 'doop';
};
try {
await firestore.runTransaction(updateFunction);
} catch (e) {
didReject = true;
should.equal(e, 'doop');
}
should.equal(didReject, true);
});
it('handle native exceptions', async () => {
const firestore = firebase.firestore();
const docRef = testDocRef('tSet');
const blockedRef = firestore.doc('denied/foo');
const updateFunction = async transaction => {
await transaction.get(docRef);
transaction.set(blockedRef, { value: 1, somethingElse: 'set' });
return 1;
};
// rejections
let didReject = false;
try {
await firestore.runTransaction(updateFunction);
} catch (e) {
// TODO sdks are giving different errors - standardise?
if (device.getPlatform() === 'ios') {
e.message.should.containEql('firestore/failed-precondition');
} else {
e.message.should.containEql('firestore/aborted');
}
didReject = true;
}
should.equal(didReject, true);
});
});
});

View File

@ -1,251 +0,0 @@
const TEST_DATA = TestHelpers.functions.data;
describe('functions()', () => {
it('accepts passing in an FirebaseApp instance as first arg', async () => {
const appName = `functionsApp${global.testRunId}1`;
const platformAppConfig = TestHelpers.core.config();
const app = await firebase
.initializeApp(platformAppConfig, appName)
.onReady();
const functionsForApp = firebase.functions(app);
functionsForApp.app.should.equal(app);
functionsForApp.app.name.should.equal(app.name);
// check from an app
app.functions().app.should.equal(app);
app.functions().app.name.should.equal(app.name);
});
it('accepts passing in a region string as first arg', async () => {
const region = 'europe-west1';
const functionsForRegion = firebase.functions(region);
// check internal region property
functionsForRegion._customUrlOrRegion.should.equal(region);
// app should be default app
functionsForRegion.app.should.equal(firebase.app());
functionsForRegion.app.name.should.equal(firebase.app().name);
firebase
.app()
.functions(region)
.app.should.equal(firebase.app());
firebase
.app()
.functions(region)
._customUrlOrRegion.should.equal(region);
const functionRunner = functionsForRegion.httpsCallable(
'runTestWithRegion'
);
const response = await functionRunner();
// the function just sends back it's region as a string
response.data.should.equal(region);
});
// TODO app and region test both args
// TODO app passed to existing app instance - should error?
describe('httpsCallable(fnName)(args)', () => {
it('accepts primitive args: undefined', async () => {
const functionRunner = firebase.functions().httpsCallable('runTest');
const response = await functionRunner();
response.data.should.equal('null');
});
it('accepts primitive args: string', async () => {
const functionRunner = firebase.functions().httpsCallable('runTest');
const response = await functionRunner('hello');
response.data.should.equal('string');
});
it('accepts primitive args: number', async () => {
const functionRunner = firebase.functions().httpsCallable('runTest');
const response = await functionRunner(123);
response.data.should.equal('number');
});
it('accepts primitive args: boolean', async () => {
const functionRunner = firebase.functions().httpsCallable('runTest');
const response = await functionRunner(true);
response.data.should.equal('boolean');
});
it('accepts primitive args: null', async () => {
const functionRunner = firebase.functions().httpsCallable('runTest');
const response = await functionRunner(null);
response.data.should.equal('null');
});
it('accepts array args', async () => {
const functionRunner = firebase.functions().httpsCallable('runTest');
const response = await functionRunner([1, 2, 3, 4]);
response.data.should.equal('array');
});
it('accepts object args', async () => {
const type = 'simpleObject';
const inputData = TEST_DATA[type];
const functionRunner = firebase.functions().httpsCallable('runTest');
const { data: outputData } = await functionRunner({
type,
inputData,
});
should.deepEqual(outputData, inputData);
});
it('accepts complex nested objects', async () => {
const type = 'advancedObject';
const inputData = TEST_DATA[type];
const functionRunner = firebase.functions().httpsCallable('runTest');
const { data: outputData } = await functionRunner({
type,
inputData,
});
should.deepEqual(outputData, inputData);
});
it('accepts complex nested arrays', async () => {
const type = 'advancedArray';
const inputData = TEST_DATA[type];
const functionRunner = firebase.functions().httpsCallable('runTest');
const { data: outputData } = await functionRunner({
type,
inputData,
});
should.deepEqual(outputData, inputData);
});
});
describe('HttpsError', () => {
it('errors return instance of HttpsError', async () => {
const functionRunner = firebase.functions().httpsCallable('runTest');
try {
await functionRunner({});
return Promise.reject(new Error('Function did not reject with error.'));
} catch (e) {
should.equal(e.details, null);
e.code.should.equal('invalid-argument');
e.message.should.equal('Invalid test requested.');
}
return Promise.resolve();
});
it('HttpsError.details -> allows returning complex data', async () => {
let type = 'advancedObject';
let inputData = TEST_DATA[type];
const functionRunner = firebase.functions().httpsCallable('runTest');
try {
await functionRunner({
type,
inputData,
asError: true,
});
return Promise.reject(new Error('Function did not reject with error.'));
} catch (e) {
should.deepEqual(e.details, inputData);
e.code.should.equal('cancelled');
e.message.should.equal(
'Response data was requested to be sent as part of an Error payload, so here we are!'
);
}
type = 'advancedArray';
inputData = TEST_DATA[type];
try {
await functionRunner({
type,
inputData,
asError: true,
});
return Promise.reject(new Error('Function did not reject with error.'));
} catch (e) {
should.deepEqual(e.details, inputData);
e.code.should.equal('cancelled');
e.message.should.equal(
'Response data was requested to be sent as part of an Error payload, so here we are!'
);
}
return Promise.resolve();
});
it('HttpsError.details -> allows returning primitives', async () => {
let type = 'number';
let inputData = TEST_DATA[type];
const functionRunner = firebase.functions().httpsCallable('runTest');
try {
await functionRunner({
type,
inputData,
asError: true,
});
return Promise.reject(new Error('Function did not reject with error.'));
} catch (e) {
e.code.should.equal('cancelled');
e.message.should.equal(
'Response data was requested to be sent as part of an Error payload, so here we are!'
);
should.deepEqual(e.details, inputData);
}
type = 'string';
inputData = TEST_DATA[type];
try {
await functionRunner({
type,
inputData,
asError: true,
});
return Promise.reject(new Error('Function did not reject with error.'));
} catch (e) {
should.deepEqual(e.details, inputData);
e.code.should.equal('cancelled');
e.message.should.equal(
'Response data was requested to be sent as part of an Error payload, so here we are!'
);
}
type = 'boolean';
inputData = TEST_DATA[type];
try {
await functionRunner({
type,
inputData,
asError: true,
});
return Promise.reject(new Error('Function did not reject with error.'));
} catch (e) {
should.deepEqual(e.details, inputData);
e.code.should.equal('cancelled');
e.message.should.equal(
'Response data was requested to be sent as part of an Error payload, so here we are!'
);
}
type = 'null';
inputData = TEST_DATA[type];
try {
await functionRunner({
type,
inputData,
asError: true,
});
return Promise.reject(new Error('Function did not reject with error.'));
} catch (e) {
should.deepEqual(e.details, inputData);
e.code.should.equal('cancelled');
e.message.should.equal(
'Response data was requested to be sent as part of an Error payload, so here we are!'
);
}
return Promise.resolve();
});
});
});

View File

@ -1,60 +0,0 @@
describe('iid()', () => {
describe('get()', () => {
it('returns instance id string', async () => {
const iid = await firebase.iid().get();
iid.should.be.a.String();
});
});
describe('delete()', () => {
it('deletes the current instance id', async () => {
const iidBefore = await firebase.iid().get();
iidBefore.should.be.a.String();
await firebase.iid().delete();
const iidAfter = await firebase.iid().get();
iidAfter.should.be.a.String();
iidBefore.should.not.equal(iidAfter);
await sleep(4000);
});
});
describe('getToken()', () => {
it('should return an FCM token from getToken with arguments', async () => {
const authorizedEntity = firebase.iid().app.options.messagingSenderId;
const token = await firebase.iid().getToken(authorizedEntity, '*');
token.should.be.a.String();
});
it('should return an FCM token from getToken without arguments', async () => {
const token = await firebase.iid().getToken();
token.should.be.a.String();
});
it('should return an FCM token from getToken with 1 argument', async () => {
const authorizedEntity = firebase.iid().app.options.messagingSenderId;
const token = await firebase.iid().getToken(authorizedEntity);
token.should.be.a.String();
});
});
describe('deleteToken()', () => {
it('should return nil from deleteToken with arguments', async () => {
const authorizedEntity = firebase.iid().app.options.messagingSenderId;
const token = await firebase.iid().deleteToken(authorizedEntity, '*');
should.not.exist(token);
});
it('should return nil from deleteToken without arguments', async () => {
const token = await firebase.iid().deleteToken();
should.not.exist(token);
});
it('should return nil from deleteToken with 1 argument', async () => {
const authorizedEntity = firebase.iid().app.options.messagingSenderId;
const token = await firebase.iid().deleteToken(authorizedEntity);
should.not.exist(token);
});
});
});

View File

@ -1,15 +0,0 @@
const detox = require('detox');
const config = require('../package.json').detox;
before(async () => {
await detox.init(config);
// needs to be called before any usage of firestore
await firebase.firestore().settings({ persistence: true });
await firebase.firestore().settings({ persistence: false });
});
after(async () => {
console.log('Cleaning up...');
await TestHelpers.firestore.cleanup();
await detox.cleanup();
});

View File

@ -1,8 +0,0 @@
--recursive
--timeout 120000
--reporter list
--slow 600
--bail
--exit
--require jet/platform/node
--require ./helpers

View File

@ -1,93 +0,0 @@
describe('perf()', () => {
describe('HttpMetric', () => {
it('start() & stop()', async () => {
const httpMetric = firebase.perf().newHttpMetric('http://foo.com', 'GET');
await httpMetric.start();
await httpMetric.stop();
});
it('removeAttribute()', async () => {
const httpMetric = firebase.perf().newHttpMetric('http://foo.com', 'GET');
await httpMetric.start();
await httpMetric.putAttribute('foo', 'bar');
const value = await httpMetric.getAttribute('foo');
should.equal(value, 'bar');
await httpMetric.removeAttribute('foo');
const value2 = await httpMetric.getAttribute('foo');
should.equal(value2, null);
await httpMetric.stop();
});
it('getAttribute() should return null', async () => {
const httpMetric = firebase.perf().newHttpMetric('http://foo.com', 'GET');
await httpMetric.start();
const value = await httpMetric.getAttribute('foo');
should.equal(value, null);
await httpMetric.removeAttribute('foo');
await httpMetric.stop();
});
it('getAttribute() should return string value', async () => {
const httpMetric = firebase.perf().newHttpMetric('http://foo.com', 'GET');
await httpMetric.start();
await httpMetric.putAttribute('foo', 'bar');
const value = await httpMetric.getAttribute('foo');
should.equal(value, 'bar');
await httpMetric.removeAttribute('foo');
await httpMetric.stop();
});
it('putAttribute()', async () => {
const httpMetric = firebase.perf().newHttpMetric('http://foo.com', 'GET');
await httpMetric.start();
await httpMetric.putAttribute('foo', 'bar');
const value = await httpMetric.getAttribute('foo');
value.should.equal('bar');
await httpMetric.removeAttribute('foo');
await httpMetric.stop();
});
it('getAttributes()', async () => {
const httpMetric = firebase.perf().newHttpMetric('http://foo.com', 'GET');
await httpMetric.start();
await httpMetric.putAttribute('foo', 'bar');
await httpMetric.putAttribute('bar', 'baz');
const value = await httpMetric.getAttributes();
value.should.deepEqual({
foo: 'bar',
bar: 'baz',
});
await httpMetric.removeAttribute('foo');
await httpMetric.removeAttribute('bar');
await httpMetric.stop();
});
it('setHttpResponseCode()', async () => {
const httpMetric = firebase.perf().newHttpMetric('http://foo.com', 'GET');
await httpMetric.start();
await httpMetric.setHttpResponseCode(500);
await httpMetric.stop();
});
it('setRequestPayloadSize()', async () => {
const httpMetric = firebase.perf().newHttpMetric('http://foo.com', 'GET');
await httpMetric.start();
await httpMetric.setRequestPayloadSize(1234567);
await httpMetric.stop();
});
it('setResponseContentType()', async () => {
const httpMetric = firebase.perf().newHttpMetric('http://foo.com', 'GET');
await httpMetric.start();
await httpMetric.setResponseContentType('application/foobar');
await httpMetric.stop();
});
it('setResponsePayloadSize()', async () => {
const httpMetric = firebase.perf().newHttpMetric('http://foo.com', 'GET');
await httpMetric.start();
await httpMetric.setResponsePayloadSize(123456789);
await httpMetric.stop();
});
});
});

View File

@ -1,49 +0,0 @@
describe('perf()', () => {
describe('setPerformanceCollectionEnabled()', () => {
it('true', async () => {
await firebase.perf().setPerformanceCollectionEnabled(true);
});
it('false', async () => {
await firebase.perf().setPerformanceCollectionEnabled(false);
await firebase.perf().setPerformanceCollectionEnabled(true);
await device.launchApp({ newInstance: true });
});
it('errors if not boolean', async () => {
(() => firebase.perf().setPerformanceCollectionEnabled()).should.throw(
'firebase.perf().setPerformanceCollectionEnabled() requires a boolean value'
);
});
});
describe('newTrace()', () => {
it('returns an instance of Trace', async () => {
const trace = firebase.perf().newTrace('foo');
trace.constructor.name.should.be.equal('Trace');
});
it('errors if identifier not a string', async () => {
(() => firebase.perf().newTrace([1, 2, 3, 4])).should.throw(
'firebase.perf().newTrace() requires a string value'
);
});
});
describe('newHttpMetric()', () => {
it('returns an instance of HttpMetric', async () => {
const trace = firebase.perf().newHttpMetric('http://foo.com', 'GET');
trace.constructor.name.should.be.equal('HttpMetric');
});
it('errors if url/httpMethod not a string', async () => {
(() => firebase.perf().newHttpMetric(123, [1, 2])).should.throw(
'firebase.perf().newHttpMetric() requires url and httpMethod string values'
);
});
it('errors if httpMethod not a valid type', async () => {
(() => firebase.perf().newHttpMetric('foo', 'FOO')).should.throw(); // TODO error
});
});
});

View File

@ -1,88 +0,0 @@
describe('perf()', () => {
describe('Trace', () => {
it('start() & stop()', async () => {
const trace = firebase.perf().newTrace('bar');
await trace.start();
await trace.stop();
});
it('getAttribute() should return null', async () => {
const trace = firebase.perf().newTrace('bar');
await trace.start();
const value = await trace.getAttribute('foo');
should.equal(value, null);
await trace.stop();
});
it('getAttribute() should return string value', async () => {
const trace = firebase.perf().newTrace('bar');
await trace.start();
await trace.putAttribute('foo', 'bar');
const value = await trace.getAttribute('foo');
should.equal(value, 'bar');
await trace.stop();
});
it('putAttribute()', async () => {
const trace = firebase.perf().newTrace('bar');
await trace.start();
await trace.putAttribute('foo', 'bar');
const value = await trace.getAttribute('foo');
value.should.equal('bar');
await trace.stop();
});
it('getAttributes()', async () => {
const trace = firebase.perf().newTrace('bar');
await trace.start();
await trace.putAttribute('foo', 'bar');
await trace.putAttribute('bar', 'baz');
const value = await trace.getAttributes();
value.should.deepEqual({
foo: 'bar',
bar: 'baz',
});
await trace.stop();
});
it('removeAttribute()', async () => {
const trace = firebase.perf().newTrace('bar');
await trace.start();
await trace.putAttribute('foobar', 'bar');
const value = await trace.getAttribute('foobar');
value.should.equal('bar');
await trace.removeAttribute('foobar');
const removed = await trace.getAttribute('foobar');
should.equal(removed, null);
await trace.stop();
});
it('getMetric()', async () => {
const trace = firebase.perf().newTrace('bar');
await trace.start();
const metric = await trace.getMetric('foo');
metric.should.equal(0);
await trace.stop();
});
it('putMetric()', async () => {
const trace = firebase.perf().newTrace('bar');
await trace.start();
await trace.putMetric('baz', 1);
const metric = await trace.getMetric('baz');
metric.should.equal(1);
await trace.stop();
});
it('incrementMetric()', async () => {
const trace = firebase.perf().newTrace('bar');
await trace.start();
await trace.putMetric('baz', 1);
await trace.incrementMetric('baz', 2);
const metric = await trace.getMetric('baz');
metric.should.equal(3);
await trace.stop();
});
});
});

View File

@ -1,147 +0,0 @@
describe('storage()', () => {
describe('ref()', () => {
describe('toString()', () => {
it('returns the correct bucket path to the file', () => {
const app = firebase.app();
firebase
.storage()
.ref('/uploadNope.jpeg')
.toString()
.should.equal(`gs://${app.options.storageBucket}/uploadNope.jpeg`);
});
});
describe('downloadFile()', () => {
it('errors if permission denied', async () => {
try {
await firebase
.storage()
.ref('/not.jpg')
.downloadFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/not.jpg`
);
return Promise.reject(new Error('No permission denied error'));
} catch (error) {
error.code.should.equal('storage/unauthorized');
error.message.includes('not authorized').should.be.true();
return Promise.resolve();
}
});
it('downloads a file', async () => {
const meta = await firebase
.storage()
.ref('/ok.jpeg')
.downloadFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/ok.jpeg`
);
meta.state.should.eql(firebase.storage.TaskState.SUCCESS);
meta.bytesTransferred.should.eql(meta.totalBytes);
});
});
describe('putFile()', () => {
before(async () => {
await firebase
.storage()
.ref('/ok.jpeg')
.downloadFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/ok.jpeg`
);
await firebase
.storage()
.ref('/cat.gif')
.downloadFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/cat.gif`
);
await firebase
.storage()
.ref('/hei.heic')
.downloadFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/hei.heic`
);
});
it('errors if permission denied', async () => {
try {
await firebase
.storage()
.ref('/uploadNope.jpeg')
.putFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/ok.jpeg`
);
return Promise.reject(new Error('No permission denied error'));
} catch (error) {
error.code.should.equal('storage/unauthorized');
error.message.includes('not authorized').should.be.true();
return Promise.resolve();
}
});
it('uploads a file', async () => {
const uploadTaskSnapshot = await firebase
.storage()
.ref('/uploadOk.jpeg')
.putFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/ok.jpeg`
);
await firebase
.storage()
.ref('/uploadCat.gif')
.putFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/cat.gif`
);
await firebase
.storage()
.ref('/uploadHei.heic')
.putFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/hei.heic`
);
uploadTaskSnapshot.state.should.eql(firebase.storage.TaskState.SUCCESS);
uploadTaskSnapshot.bytesTransferred.should.eql(
uploadTaskSnapshot.totalBytes
);
uploadTaskSnapshot.metadata.should.be.an.Object();
uploadTaskSnapshot.downloadURL.should.be.a.String();
});
});
describe('on()', () => {
before(async () => {
await firebase
.storage()
.ref('/ok.jpeg')
.downloadFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/ok.jpeg`
);
});
it('listens to upload state', () => {
const { resolve, reject, promise } = Promise.defer();
const path = `${
firebase.storage.Native.DOCUMENT_DIRECTORY_PATH
}/ok.jpeg`;
const ref = firebase.storage().ref('/uploadOk.jpeg');
const unsubscribe = ref.putFile(path).on(
firebase.storage.TaskEvent.STATE_CHANGED,
snapshot => {
if (snapshot.state === firebase.storage.TaskState.SUCCESS) {
resolve();
}
},
error => {
unsubscribe();
reject(error);
}
);
return promise;
});
});
});
});

View File

@ -1 +0,0 @@
{}

View File

@ -1,68 +0,0 @@
const assert = require('assert');
const functions = require('firebase-functions');
const TEST_DATA = require('./test-data');
exports.runTestWithRegion = functions
.region('europe-west1')
.https.onCall(() => 'europe-west1');
exports.runTest = functions.https.onCall(data => {
console.log(Date.now(), data);
if (typeof data === 'undefined') {
return 'undefined';
}
if (typeof data === 'string') {
return 'string';
}
if (typeof data === 'number') {
return 'number';
}
if (typeof data === 'boolean') {
return 'boolean';
}
if (data === null) {
return 'null';
}
if (Array.isArray(data)) {
return 'array';
}
const { type, asError, inputData } = data;
if (!Object.hasOwnProperty.call(TEST_DATA, type)) {
throw new functions.https.HttpsError(
'invalid-argument',
'Invalid test requested.'
);
}
const outputData = TEST_DATA[type];
try {
assert.deepEqual(outputData, inputData);
} catch (e) {
console.error(e);
throw new functions.https.HttpsError(
'invalid-argument',
'Input and Output types did not match.',
e.message
);
}
// all good
if (asError) {
throw new functions.https.HttpsError(
'cancelled',
'Response data was requested to be sent as part of an Error payload, so here we are!',
outputData
);
}
return outputData;
});

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +0,0 @@
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"dependencies": {
"firebase-admin": "^6.0.0",
"firebase-functions": "^2.0.5"
},
"private": true
}

View File

@ -1,41 +0,0 @@
module.exports = {
number: 1234,
string: 'acde',
boolean: true,
null: null,
simpleObject: {
number: 1234,
string: 'acde',
boolean: true,
null: null,
},
simpleArray: [1234, 'acde', true, null],
advancedObject: {
array: [1234, 'acde', false, null],
object: {
number: 1234,
string: 'acde',
boolean: true,
null: null,
array: [1234, 'acde', true, null],
},
number: 1234,
string: 'acde',
boolean: true,
null: null,
},
advancedArray: [
1234,
'acde',
true,
null,
[1234, 'acde', true, null],
{
number: 1234,
string: 'acde',
boolean: true,
null: null,
array: [1234, 'acde', true, null],
},
],
};

View File

@ -1,118 +0,0 @@
module.exports = {
DEFAULT: {
array: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
boolean: true,
string: 'foobar',
number: 123567890,
object: {
foo: 'bar',
},
},
NEW: {
array: [9, 8, 7, 6, 5, 4],
boolean: false,
string: 'baz',
number: 84564564,
object: {
foo: 'baz',
},
},
QUERY: [
{
search: 'foo',
},
{
search: 'bar',
},
{
search: 'blah',
},
],
ISSUES: {
// https://github.com/invertase/react-native-firebase/issues/100
100: {
1: {
someKey: 'someValue',
someOtherKey: 'someOtherValue',
},
2: {
someKey: 'someValue',
someOtherKey: 'someOtherValue',
},
3: {
someKey: 'someValue',
someOtherKey: 'someOtherValue',
},
},
// https://github.com/invertase/react-native-firebase/issues/108
108: {
foobar: {
name: 'Foobar Pizzas',
latitude: 34.1013717,
},
notTheFoobar: {
name: "Not the pizza you're looking for",
latitude: 34.456787,
},
notAFloat: {
name: 'Not a float',
latitude: 37,
},
},
// https://github.com/invertase/react-native-firebase/issues/171
171: {
10053768200609241: {
email: 'emaila@hotmail.com',
name: 'Sek Ranger',
profile_picture: 'https://url.to/picture',
uid: 'n6V8vACidyW4OKxnELkBbW83JaS2',
},
10053925505239749: {
email: 'emailb@hotmail.com',
name: 'Gu Hungry',
profile_picture: 'https://url.to/picture',
uid: 'Qq4Pwm7H2kO6sJIMLAJxuhAGGh22',
},
10106631429240929: {
email: 'emailc@gmail.com',
name: 'Chwang',
profile_picture: 'https://url.to/picture',
uid: 'T7VVrveS0dPs3idmgetLUfQsLZs1',
},
10106631429240930: {
email: 'emaild@gmail.com',
name: 'Introv Bigs',
profile_picture: 'https://url.to/picture',
uid: 'aNYxLexOb2WsXGOPiEAu47q5bxH3',
},
},
489: {
long1: 1508777379000,
},
// https://github.com/invertase/react-native-firebase/issues/521
521: {
key1: {
name: 'Item 1',
number: 1,
string: 'item1',
},
key3: {
name: 'Item 3',
number: 3,
string: 'item3',
},
key2: {
name: 'Item 2',
number: 2,
string: 'item2',
},
},
},
};

View File

@ -1,18 +0,0 @@
const CONTENTS = require('./content');
module.exports = {
CONTENTS,
setDatabaseContents() {
const database = firebaseAdmin.database();
return Promise.all([
database.ref('tests/types').set(CONTENTS.DEFAULT),
database.ref('tests/priority').setWithPriority(
{
foo: 'bar',
},
666
),
database.ref('tests/query').set(CONTENTS.QUERY),
]);
},
};

View File

@ -1,168 +0,0 @@
const TEST_COLLECTION_NAME = 'tests';
const TEST2_COLLECTION_NAME = 'tests2';
// const TEST3_COLLECTION_NAME = 'tests3';
let shouldCleanup = false;
const ONE_HOUR = 60 * 60 * 1000;
module.exports = {
async cleanup() {
if (!shouldCleanup) return Promise.resolve();
await Promise.all([
module.exports.cleanCollection(TEST_COLLECTION_NAME),
module.exports.cleanCollection(TEST2_COLLECTION_NAME),
]);
// await module.exports.cleanCollection(`${TEST_COLLECTION_NAME}3`);
// await module.exports.cleanCollection(`${TEST_COLLECTION_NAME}4`);
return Promise.resolve();
},
TEST_COLLECTION_NAME,
TEST2_COLLECTION_NAME,
// TEST3_COLLECTION_NAME,
DOC_1: { name: 'doc1' },
DOC_1_PATH: `tests/doc1${testRunId}`,
DOC_2: { name: 'doc2', title: 'Document 2' },
DOC_2_PATH: `tests/doc2${testRunId}`,
// needs to be a fn as firebase may not yet be available
COL_DOC_1() {
shouldCleanup = true;
return {
baz: true,
daz: 123,
foo: 'bar',
gaz: 12.1234567,
geopoint: new firebase.firestore.GeoPoint(0, 0),
naz: null,
object: {
daz: 123,
},
timestamp: new bridge.context.window.Date(2017, 2, 10, 10, 0, 0),
};
},
// needs to be a fn as firebase may not yet be available
COL2_DOC_1() {
shouldCleanup = true;
return {
baz: true,
daz: 123,
foo: 'bar',
gaz: 12.1234567,
geopoint: new firebase.firestore.GeoPoint(0, 0),
naz: null,
object: {
daz: 123,
},
timestamp: new bridge.context.window.Date(2017, 2, 10, 10, 0, 0),
};
},
COL_DOC_1_ID: `col1${testRunId}`,
COL_DOC_1_PATH: `${TEST_COLLECTION_NAME}/col1${testRunId}`,
COL2_DOC_1_ID: `doc1${testRunId}`,
COL2_DOC_1_PATH: `${TEST2_COLLECTION_NAME}/doc1${testRunId}`,
/**
* Removes all documents on the collection for the current testId or
* documents older than 24 hours
*
* @param collectionName
* @return {Promise<*>}
*/
async cleanCollection(collectionName) {
const firestore = firebaseAdmin.firestore();
const collection = firestore.collection(
collectionName || TEST_COLLECTION_NAME
);
const docsToDelete = (await collection.get()).docs;
const yesterday = new Date(new Date() - 24 * ONE_HOUR);
if (docsToDelete.length) {
const batch = firestore.batch();
for (let i = 0, len = docsToDelete.length; i < len; i++) {
const { ref } = docsToDelete[i];
if (
ref.path.includes(testRunId) ||
new Date(docsToDelete[i].createTime) <= yesterday
) {
batch.delete(ref);
}
}
if (!batch._writes.length) return Promise.resolve();
return batch.commit();
}
return Promise.resolve();
},
testDocRef(docId) {
shouldCleanup = true;
return firebase
.firestore()
.collection(TEST_COLLECTION_NAME)
.doc(
docId.startsWith(testRunId) || docId.endsWith(testRunId)
? docId
: `${testRunId}${docId}`
);
},
test2DocRef(docId) {
shouldCleanup = true;
return firebase
.firestore()
.collection(TEST2_COLLECTION_NAME)
.doc(
docId.startsWith(testRunId) || docId.endsWith(testRunId)
? docId
: `${testRunId}${docId}`
);
},
testCollection(collection) {
shouldCleanup = true;
return firebase.firestore().collection(collection);
},
testCollectionDoc(path) {
shouldCleanup = true;
return firebase.firestore().doc(path);
},
testCollectionDocAdmin(path) {
shouldCleanup = true;
return firebaseAdmin.firestore().doc(path);
},
async resetTestCollectionDoc(path, doc) {
shouldCleanup = true;
const _doc = doc || module.exports.COL_DOC_1();
await firebase
.firestore()
.doc(path || module.exports.COL_DOC_1_PATH)
.set(_doc);
return _doc;
},
};
firebaseAdmin.firestore().settings({ timestampsInSnapshots: true });
// call a get request without waiting to force firestore to connect
// so the first test isn't delayed whilst connecting
module.exports
.testCollectionDocAdmin(module.exports.DOC_1_PATH)
.get()
.then(() => {})
.catch(() => {});

View File

@ -1,153 +0,0 @@
/* eslint-disable global-require */
global.sinon = require('sinon');
require('should-sinon');
global.should = require('should');
Object.defineProperty(global, 'firebase', {
get() {
return bridge.module;
},
});
// TODO move as part of bridge
const { Uint8Array } = global;
Object.defineProperty(global, 'Uint8Array', {
get() {
const { stack } = new Error();
if (
(stack.includes('Context.it') || stack.includes('Context.beforeEach')) &&
global.bridge &&
global.bridge.context
) {
return bridge.context.window.Uint8Array;
}
return Uint8Array;
},
});
// TODO move as part of bridge
const { Array } = global;
Object.defineProperty(global, 'Array', {
get() {
const { stack } = new Error();
if (
(stack.includes('Context.it') || stack.includes('Context.beforeEach')) &&
global.bridge &&
global.bridge.context
) {
return bridge.context.window.Array;
}
return Array;
},
});
global.isObject = function isObject(item) {
return item
? typeof item === 'object' && !Array.isArray(item) && item !== null
: false;
};
global.sleep = duration =>
new Promise(resolve => setTimeout(resolve, duration));
global.randomString = (length, chars) => {
let mask = '';
if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz';
if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
if (chars.indexOf('#') > -1) mask += '0123456789';
if (chars.indexOf('!') > -1) mask += '~`!@#$%^&*()_+-={}[]:";\'<>?,./|\\';
let result = '';
for (let i = length; i > 0; --i) {
result += mask[Math.round(Math.random() * (mask.length - 1))];
}
return result;
};
global.testRunId = randomString(4, 'aA#');
/** ------------------
* Init WEB SDK
---------------------*/
/** ------------------
* Init ADMIN SDK
---------------------*/
global.firebaseAdmin = require('firebase-admin');
firebaseAdmin.initializeApp({
credential: firebaseAdmin.credential.cert(require('./service-account')),
databaseURL: 'https://rnfirebase-b9ad4.firebaseio.com',
});
const originalLog = console.log;
console.log = (...args) => {
if (
args &&
args[0] &&
typeof args[0] === 'string' &&
(args[0].toLowerCase().includes('deprecated') ||
args[0].toLowerCase().includes('restrictions in the native sdk'))
) {
return undefined;
}
return originalLog(...args);
};
/**
* Old style deferred promise shim - for niceness
*
* @returns {{resolve: null, reject: null}}
*/
Promise.defer = function defer() {
const deferred = {
resolve: null,
reject: null,
};
deferred.promise = new Promise((resolve, reject) => {
deferred.resolve = resolve;
deferred.reject = reject;
});
return deferred;
};
const androidTestConfig = {
// firebase android sdk completely ignores client id
clientId:
'305229645282-j8ij0jev9ut24odmlk9i215pas808ugn.apps.googleusercontent.com',
appId: '1:305229645282:android:af36d4d29a83e04c',
apiKey: 'AIzaSyCzbBYFyX8d6VdSu7T4s10IWYbPc-dguwM',
databaseURL: 'https://rnfirebase-b9ad4.firebaseio.com',
storageBucket: 'rnfirebase-b9ad4.appspot.com',
messagingSenderId: '305229645282',
projectId: 'rnfirebase-b9ad4',
};
const iosTestConfig = {
clientId:
'305229645282-22imndi01abc2p6esgtu1i1m9mqrd0ib.apps.googleusercontent.com',
androidClientId: androidTestConfig.clientId,
appId: '1:305229645282:ios:af36d4d29a83e04c',
apiKey: 'AIzaSyAcdVLG5dRzA1ck_fa_xd4Z0cY7cga7S5A',
databaseURL: 'https://rnfirebase-b9ad4.firebaseio.com',
storageBucket: 'rnfirebase-b9ad4.appspot.com',
messagingSenderId: '305229645282',
projectId: 'rnfirebase-b9ad4',
};
global.TestHelpers = {
functions: {
data: require('./../functions/test-data'),
},
firestore: require('./firestore'),
database: require('./database'),
core: {
config() {
const config =
device.getPlatform() === 'ios' ? iosTestConfig : androidTestConfig;
return { ...config };
},
},
};

View File

@ -1,13 +0,0 @@
{
"type": "service_account",
"project_id": "rnfirebase-b9ad4",
"private_key_id": "749dd48dde76108c94ee0d97282868c452eb80d9",
"private_key":
"-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDj1+lFlzUikGV8\nRFCrW320Cn2NgRkP09keSFY9NWWvWTE3vsYAjmLFmb1M0LKF5HfmrMUZ0tbafll5\nm4gw9T5Px/Ry5lrwrnmNNc6yR9Oj1kXoUtESo8f8mxxmufEv+Z1Fk0mq4T0nSRn8\nPsrHbNlwGWMdpi63NEvbDnq/aH/E0//g+7T3xcGg6dxjJM44qxfU5z5AYovsc+yI\nyAuMS54PvicQa2MSIywqtapCX3QIOlcz2KXqf7t3KhPnA+M6XhO3vetcoCbeGwwC\na5DRaKepcnrQslOltDUJ158+d5BKcZ0Wr0ctU9HI9VoJjUjj//krXHG/KeePbPW+\niUhM4mBnAgMBAAECggEAGxypqvjDv2GsWd2tNb7U1fQ7nXeDunDskKBt9qmgeH2m\nECqY2B8ZXMcfEgFxhOI7bE0ZxSlkHKrVTdW2npDIQekaywNjRemVGDsTZf6LDh9k\nwTD9pPitRv9UIVs1+o3663kL1pQn2UFnIK9+JL3sn9y9gR0xyOYlsqLl81nlfk+8\nTFV42cIXmGZov/GuHcgijdFpVwa2SF2jiV1ZmnWFabsObn8N3Rhbu5UsjYfv0hk2\nCdZSMhJvPwbNW0sJUtRJGQCfoTHGTApfVgfNac7kY4CRCZW79b5DcbD9aXpbZuKH\no9MNXQ7v9CskMU/02GmGuKUhuUx0WNq7em2II4LbMQKBgQD5lP+ha5av6C/W7CuJ\n6wB/yhQz9xus+RQ+bTIkWWtycvJTFxDpZ03+y/TxByRVeEEO90mT/0zFvVVwjQq0\njJD3FjyhHZvd9V7wCD5HjBGoLDJC8oHZUx9EN2VWx3P/DmjksQLJaK6k2URMk2Nl\nzOiz61vHtzfLZW2fInMtei3w0QKBgQDps86a6vkjujQmDNjMkZwSzLvLKYxKHH3u\n6GVWPeKN9BE8KialdBH+nDlfxYOntjMV8bwXReUy9zLjQxztStMjUW7i4WXUenr3\n78Qo/5sKoy8INv5RJF7mz7UhqiY4UKr/t92o4e7rrE+5wTNrB8gJ4IfVO8HM8Vok\nj1llyB5LtwKBgBZNGgpycqSFOsEZmUpZlVHV3LhH/FEYcJajazeUReWUH9MM3JX+\nhRmfX+Opn7WDaUzNC+YNie6hXGESOUKozMtHUWOUIblTk4gfNHFwMqO0T0lsIe4p\nX0HZMVTvvY2s2/KTXoxgrjpMr62n/dm61ZA+F5Vg6bti9Mija2dE45YBAoGALt4P\nZgQPeLnD8YmMBOKCsUZ7ts+bQdWa78mNYRFCGQPEXRN68p1nam88FlfPAlhIwHLd\nLLGouGLYwrjX2UKzOxb+rONU/5qchJKB/VLdbfGx4ezdbbpkiddH1PuBdLPAx03B\nVzgQKRVCW9dCD4nc9RYhR4MXZ5lTYZeZ7w6F/NsCgYBJFhawdZjjBhzFpS5wPMCc\n4Z8kf7cum1hRJLVjJDE8lhMfn+3aqKq8YwynLur0bYn/M8z/NWhiak5pDvO98JQ2\nsFkiTv1t0oNOOo/h7ZdEWIU3U9+SpjxsH8U5bLD/xCpR2ZPtrKgLGAwfd/miyDhx\nYMkyfnONKey1VWH9JVqRHg==\n-----END PRIVATE KEY-----\n",
"client_email": "firebase-adminsdk-g5d00@rnfirebase-b9ad4.iam.gserviceaccount.com",
"client_id": "115889980718069163179",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-g5d00%40rnfirebase-b9ad4.iam.gserviceaccount.com"
}

View File

@ -1 +0,0 @@
require('./app');

View File

@ -1 +0,0 @@
require('./app');

View File

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AD_UNIT_ID_FOR_BANNER_TEST</key>
<string>ca-app-pub-3940256099942544/2934735716</string>
<key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key>
<string>ca-app-pub-3940256099942544/4411468910</string>
<key>CLIENT_ID</key>
<string>305229645282-9i07a33r4sj2fmrshnmh8jkh52dgpdve.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.305229645282-9i07a33r4sj2fmrshnmh8jkh52dgpdve</string>
<key>API_KEY</key>
<string>AIzaSyAcdVLG5dRzA1ck_fa_xd4Z0cY7cga7S5A</string>
<key>GCM_SENDER_ID</key>
<string>305229645282</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.testing</string>
<key>PROJECT_ID</key>
<string>rnfirebase-b9ad4</string>
<key>STORAGE_BUCKET</key>
<string>rnfirebase-b9ad4.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<true></true>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<false></false>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:305229645282:ios:af36d4d29a83e04c</string>
<key>DATABASE_URL</key>
<string>https://rnfirebase-b9ad4.firebaseio.com</string>
</dict>
</plist>

View File

@ -1,51 +0,0 @@
install! 'cocoapods', :deterministic_uuids => false
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
target 'testing' do
platform :ios, '9.0'
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
react_native_path = "../node_modules/react-native"
pod "yoga", :path => "#{react_native_path}/ReactCommon/yoga"
# Pods for ReactNativeFirebaseDemo
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'RCTText',
'RCTNetwork',
'RCTWebSocket',
]
pod 'Firebase/AdMob', '~> 5.6.0'
pod 'Firebase/Auth', '~> 5.6.0'
pod 'Firebase/Core', '~> 5.6.0'
pod 'Firebase/Database', '~> 5.6.0'
pod 'Firebase/Functions', '~> 5.6.0'
pod 'Firebase/DynamicLinks', '~> 5.6.0'
pod 'Firebase/Firestore', '~> 5.6.0'
pod 'Firebase/Invites', '~> 5.6.0'
pod 'Firebase/Messaging', '~> 5.6.0'
pod 'Firebase/RemoteConfig', '~> 5.6.0'
pod 'Firebase/Storage', '~> 5.6.0'
pod 'Firebase/Performance', '~> 5.6.0'
pod 'Fabric', '~> 1.7.11'
pod 'Crashlytics', '~> 3.10.7'
pod 'RNFirebase', :path => '../../ios/RNFirebase.podspec'
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
if target.name == 'yoga'
target.build_configurations.each do |config|
config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'NO'
config.build_settings['GCC_WARN_64_TO_32_BIT_CONVERSION'] = 'NO'
end
end
end
end
end

View File

@ -1,352 +0,0 @@
PODS:
- BoringSSL (10.0.6):
- BoringSSL/Implementation (= 10.0.6)
- BoringSSL/Interface (= 10.0.6)
- BoringSSL/Implementation (10.0.6):
- BoringSSL/Interface (= 10.0.6)
- BoringSSL/Interface (10.0.6)
- Crashlytics (3.10.7):
- Fabric (~> 1.7.11)
- Fabric (1.7.11)
- Firebase/AdMob (5.6.0):
- Firebase/Core
- Google-Mobile-Ads-SDK (= 7.31.0)
- Firebase/Auth (5.6.0):
- Firebase/CoreOnly
- FirebaseAuth (= 5.0.3)
- Firebase/Core (5.6.0):
- Firebase/CoreOnly
- FirebaseAnalytics (= 5.1.1)
- Firebase/CoreOnly (5.6.0):
- FirebaseCore (= 5.1.1)
- Firebase/Database (5.6.0):
- Firebase/CoreOnly
- FirebaseDatabase (= 5.0.2)
- Firebase/DynamicLinks (5.6.0):
- Firebase/Core
- FirebaseDynamicLinks (= 3.0.2)
- Firebase/Firestore (5.6.0):
- Firebase/CoreOnly
- FirebaseFirestore (= 0.13.1)
- Firebase/Functions (5.6.0):
- Firebase/CoreOnly
- FirebaseFunctions (= 2.1.0)
- Firebase/Invites (5.6.0):
- Firebase/Core
- FirebaseInvites (= 3.0.0)
- Firebase/Messaging (5.6.0):
- Firebase/CoreOnly
- FirebaseMessaging (= 3.1.0)
- Firebase/Performance (5.6.0):
- Firebase/Core
- FirebasePerformance (= 2.1.1)
- Firebase/RemoteConfig (5.6.0):
- Firebase/Core
- FirebaseRemoteConfig (= 3.0.1)
- Firebase/Storage (5.6.0):
- Firebase/CoreOnly
- FirebaseStorage (= 3.0.0)
- FirebaseABTesting (2.0.0):
- FirebaseCore (~> 5.0)
- Protobuf (~> 3.5)
- FirebaseAnalytics (5.1.1):
- FirebaseCore (~> 5.1)
- FirebaseInstanceID (~> 3.2)
- GoogleAppMeasurement (~> 5.1)
- GoogleUtilities/AppDelegateSwizzler (~> 5.2.0)
- GoogleUtilities/MethodSwizzler (~> 5.2.0)
- GoogleUtilities/Network (~> 5.2)
- "GoogleUtilities/NSData+zlib (~> 5.2)"
- nanopb (~> 0.3)
- FirebaseAuth (5.0.3):
- FirebaseAuthInterop (~> 1.0)
- FirebaseCore (~> 5.0)
- GoogleUtilities/Environment (~> 5.2)
- GTMSessionFetcher/Core (~> 1.1)
- FirebaseAuthInterop (1.0.0)
- FirebaseCore (5.1.1):
- GoogleUtilities/Logger (~> 5.2)
- FirebaseDatabase (5.0.2):
- FirebaseCore (~> 5.0)
- leveldb-library (~> 1.18)
- FirebaseDynamicLinks (3.0.2):
- FirebaseAnalytics (~> 5.1)
- FirebaseFirestore (0.13.1):
- FirebaseAuthInterop (~> 1.0)
- FirebaseCore (~> 5.0)
- FirebaseFirestore/abseil-cpp (= 0.13.1)
- gRPC-ProtoRPC (~> 1.0)
- leveldb-library (~> 1.18)
- nanopb (~> 0.3.8)
- Protobuf (~> 3.1)
- FirebaseFirestore/abseil-cpp (0.13.1):
- FirebaseAuthInterop (~> 1.0)
- FirebaseCore (~> 5.0)
- gRPC-ProtoRPC (~> 1.0)
- leveldb-library (~> 1.18)
- nanopb (~> 0.3.8)
- Protobuf (~> 3.1)
- FirebaseFunctions (2.1.0):
- FirebaseCore (~> 5.0)
- GTMSessionFetcher/Core (~> 1.1)
- FirebaseInstanceID (3.2.1):
- FirebaseCore (~> 5.1)
- GoogleUtilities/Environment (~> 5.2)
- FirebaseInvites (3.0.0):
- FirebaseAnalytics (~> 5.0)
- FirebaseDynamicLinks (~> 3.0)
- GoogleAPIClientForREST (~> 1.0)
- GoogleSignIn (~> 4.1)
- GoogleToolboxForMac/Logger (~> 2.1)
- "GoogleToolboxForMac/NSDictionary+URLArguments (~> 2.1)"
- "GoogleToolboxForMac/NSString+URLArguments (~> 2.1)"
- GoogleToolboxForMac/StringEncoding (~> 2.1)
- GoogleToolboxForMac/URLBuilder (~> 2.1)
- GTMOAuth2 (~> 1.0)
- GTMSessionFetcher/Core (~> 1.1)
- GTMSessionFetcher/Full (~> 1.1)
- Protobuf (~> 3.5)
- FirebaseMessaging (3.1.0):
- FirebaseCore (~> 5.0)
- FirebaseInstanceID (~> 3.0)
- GoogleUtilities/Reachability (~> 5.2)
- Protobuf (~> 3.1)
- FirebasePerformance (2.1.1):
- FirebaseAnalytics (~> 5.1)
- FirebaseInstanceID (~> 3.2)
- GoogleToolboxForMac/Logger (~> 2.1)
- "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
- GoogleUtilities/ISASwizzler (~> 5.2.0)
- GoogleUtilities/MethodSwizzler (~> 5.2.0)
- GTMSessionFetcher/Core (~> 1.1)
- Protobuf (~> 3.5)
- FirebaseRemoteConfig (3.0.1):
- FirebaseABTesting (~> 2.0)
- FirebaseAnalytics (~> 5.1)
- FirebaseCore (~> 5.1)
- FirebaseInstanceID (~> 3.2)
- GoogleUtilities/Environment (~> 5.2)
- "GoogleUtilities/NSData+zlib (~> 5.2)"
- Protobuf (~> 3.5)
- FirebaseStorage (3.0.0):
- FirebaseCore (~> 5.0)
- GTMSessionFetcher/Core (~> 1.1)
- Google-Mobile-Ads-SDK (7.31.0)
- GoogleAPIClientForREST (1.3.6):
- GoogleAPIClientForREST/Core (= 1.3.6)
- GTMSessionFetcher (>= 1.1.7)
- GoogleAPIClientForREST/Core (1.3.6):
- GTMSessionFetcher (>= 1.1.7)
- GoogleAppMeasurement (5.1.1):
- GoogleUtilities/AppDelegateSwizzler (~> 5.2.0)
- GoogleUtilities/MethodSwizzler (~> 5.2.0)
- GoogleUtilities/Network (~> 5.2)
- "GoogleUtilities/NSData+zlib (~> 5.2)"
- nanopb (~> 0.3)
- GoogleSignIn (4.2.0):
- "GoogleToolboxForMac/NSDictionary+URLArguments (~> 2.1)"
- "GoogleToolboxForMac/NSString+URLArguments (~> 2.1)"
- GTMOAuth2 (~> 1.0)
- GTMSessionFetcher/Core (~> 1.1)
- GoogleToolboxForMac/Core (2.1.4):
- GoogleToolboxForMac/Defines (= 2.1.4)
- GoogleToolboxForMac/DebugUtils (2.1.4):
- GoogleToolboxForMac/Defines (= 2.1.4)
- GoogleToolboxForMac/Defines (2.1.4)
- GoogleToolboxForMac/Logger (2.1.4):
- GoogleToolboxForMac/Defines (= 2.1.4)
- "GoogleToolboxForMac/NSData+zlib (2.1.4)":
- GoogleToolboxForMac/Defines (= 2.1.4)
- "GoogleToolboxForMac/NSDictionary+URLArguments (2.1.4)":
- GoogleToolboxForMac/DebugUtils (= 2.1.4)
- GoogleToolboxForMac/Defines (= 2.1.4)
- "GoogleToolboxForMac/NSString+URLArguments (= 2.1.4)"
- "GoogleToolboxForMac/NSString+URLArguments (2.1.4)"
- GoogleToolboxForMac/StringEncoding (2.1.4):
- GoogleToolboxForMac/Defines (= 2.1.4)
- GoogleToolboxForMac/URLBuilder (2.1.4):
- GoogleToolboxForMac/Core (= 2.1.4)
- GoogleToolboxForMac/Defines (= 2.1.4)
- "GoogleToolboxForMac/NSDictionary+URLArguments (= 2.1.4)"
- "GoogleToolboxForMac/NSString+URLArguments (= 2.1.4)"
- GoogleUtilities/AppDelegateSwizzler (5.2.2):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (5.2.2)
- GoogleUtilities/ISASwizzler (5.2.2)
- GoogleUtilities/Logger (5.2.2):
- GoogleUtilities/Environment
- GoogleUtilities/MethodSwizzler (5.2.2):
- GoogleUtilities/Logger
- GoogleUtilities/Network (5.2.2):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (5.2.2)"
- GoogleUtilities/Reachability (5.2.2):
- GoogleUtilities/Logger
- gRPC (1.14.1):
- gRPC-RxLibrary (= 1.14.1)
- gRPC/Main (= 1.14.1)
- gRPC-Core (1.14.1):
- gRPC-Core/Implementation (= 1.14.1)
- gRPC-Core/Interface (= 1.14.1)
- gRPC-Core/Implementation (1.14.1):
- BoringSSL (~> 10.0)
- gRPC-Core/Interface (= 1.14.1)
- nanopb (~> 0.3)
- gRPC-Core/Interface (1.14.1)
- gRPC-ProtoRPC (1.14.1):
- gRPC-ProtoRPC/Main (= 1.14.1)
- gRPC-ProtoRPC/Main (1.14.1):
- gRPC (= 1.14.1)
- gRPC-RxLibrary (= 1.14.1)
- Protobuf (~> 3.0)
- gRPC-RxLibrary (1.14.1)
- gRPC/Main (1.14.1):
- gRPC-Core (= 1.14.1)
- gRPC-RxLibrary (= 1.14.1)
- GTMOAuth2 (1.1.6):
- GTMSessionFetcher (~> 1.1)
- GTMSessionFetcher (1.2.0):
- GTMSessionFetcher/Full (= 1.2.0)
- GTMSessionFetcher/Core (1.2.0)
- GTMSessionFetcher/Full (1.2.0):
- GTMSessionFetcher/Core (= 1.2.0)
- leveldb-library (1.20)
- nanopb (0.3.8):
- nanopb/decode (= 0.3.8)
- nanopb/encode (= 0.3.8)
- nanopb/decode (0.3.8)
- nanopb/encode (0.3.8)
- Protobuf (3.6.1)
- React (0.56.0):
- React/Core (= 0.56.0)
- React/Core (0.56.0):
- yoga (= 0.56.0.React)
- React/fishhook (0.56.0)
- React/RCTBlob (0.56.0):
- React/Core
- React/RCTNetwork (0.56.0):
- React/Core
- React/RCTText (0.56.0):
- React/Core
- React/RCTWebSocket (0.56.0):
- React/Core
- React/fishhook
- React/RCTBlob
- RNFirebase (5.0.0-rc0):
- Firebase/Core
- React
- yoga (0.56.0.React)
DEPENDENCIES:
- Crashlytics (~> 3.10.7)
- Fabric (~> 1.7.11)
- Firebase/AdMob (~> 5.6.0)
- Firebase/Auth (~> 5.6.0)
- Firebase/Core (~> 5.6.0)
- Firebase/Database (~> 5.6.0)
- Firebase/DynamicLinks (~> 5.6.0)
- Firebase/Firestore (~> 5.6.0)
- Firebase/Functions (~> 5.6.0)
- Firebase/Invites (~> 5.6.0)
- Firebase/Messaging (~> 5.6.0)
- Firebase/Performance (~> 5.6.0)
- Firebase/RemoteConfig (~> 5.6.0)
- Firebase/Storage (~> 5.6.0)
- React/Core (from `../node_modules/react-native`)
- React/RCTNetwork (from `../node_modules/react-native`)
- React/RCTText (from `../node_modules/react-native`)
- React/RCTWebSocket (from `../node_modules/react-native`)
- RNFirebase (from `../../ios/RNFirebase.podspec`)
- yoga (from `../node_modules/react-native/ReactCommon/yoga`)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- BoringSSL
- Crashlytics
- Fabric
- Firebase
- FirebaseABTesting
- FirebaseAnalytics
- FirebaseAuth
- FirebaseAuthInterop
- FirebaseCore
- FirebaseDatabase
- FirebaseDynamicLinks
- FirebaseFirestore
- FirebaseFunctions
- FirebaseInstanceID
- FirebaseInvites
- FirebaseMessaging
- FirebasePerformance
- FirebaseRemoteConfig
- FirebaseStorage
- Google-Mobile-Ads-SDK
- GoogleAPIClientForREST
- GoogleAppMeasurement
- GoogleSignIn
- GoogleToolboxForMac
- GoogleUtilities
- gRPC
- gRPC-Core
- gRPC-ProtoRPC
- gRPC-RxLibrary
- GTMOAuth2
- GTMSessionFetcher
- leveldb-library
- nanopb
- Protobuf
EXTERNAL SOURCES:
React:
:path: "../node_modules/react-native"
RNFirebase:
:path: "../../ios/RNFirebase.podspec"
yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"
SPEC CHECKSUMS:
BoringSSL: e10f92a27043805c01071fe815a5cd98ae8212e7
Crashlytics: ccaac42660eb9351b9960c0d66106b0bcf99f4fa
Fabric: f233c9492b3bbc1f04e3882986740f7988a58edb
Firebase: 75ea9e232eefa158c1049028030b8f661a2ccb62
FirebaseABTesting: 1f50b8d50f5e3469eea54e7463a7b7fe221d1f5e
FirebaseAnalytics: 993577e91157feb40945abedd6ab346d8a4b6ac8
FirebaseAuth: 657a25e4be044d2d333663ebf515a861c5a59cd7
FirebaseAuthInterop: 0ffa57668be100582bb7643d4fcb7615496c41fc
FirebaseCore: cb9ee75e0894def766167c95a4d5a14b1c138269
FirebaseDatabase: 27be5ac5bc75e0b17537b2bbfada8258addcc8cd
FirebaseDynamicLinks: eb41fb20677b0a6e944b47f45cbe59f388e9e5cc
FirebaseFirestore: e953e8e02544cc60372f3787d4c30cb47a691aa7
FirebaseFunctions: 0cb3bc0bbeac1daf6fea378a1064ff7f484e4c4e
FirebaseInstanceID: ea5af6920d0a4a29b40459d055bebe4a6c1333c4
FirebaseInvites: d7534f94d0610b892bac8ee0cf4218a14be46c28
FirebaseMessaging: f67b3719f520ee200da0e20ce577fe2bce0c01d0
FirebasePerformance: e732cd3fe9488c68bf2e9ae7a55672e873d0c55a
FirebaseRemoteConfig: 7b6d675dfb11f0e0e638caee00908b06af150d56
FirebaseStorage: 7ca4bb7b58a25fa647b04f524033fc7cb7eb272b
Google-Mobile-Ads-SDK: 6e529e748b45507a2ca904e0b5a52669ba3920c4
GoogleAPIClientForREST: 5b95b38a0fa912e8ac7bdcf9e124578ef1a61bf2
GoogleAppMeasurement: f7507b39b70ad0bd80b3d81518b2f43868974307
GoogleSignIn: 591e46382014e591269f862ba6e7bc0fbd793532
GoogleToolboxForMac: 91c824d21e85b31c2aae9bb011c5027c9b4e738f
GoogleUtilities: 06b66f9567769a7958db20a92f0128b2843e49d5
gRPC: 65fa2a50c4fd61940b76f4962d75c239c92c6a8d
gRPC-Core: e3ace1e1161e75903135de8d8231bb69c9d35721
gRPC-ProtoRPC: 78f976fc6a1eafc0e1f4965c255c313aa0859b1e
gRPC-RxLibrary: c4c826507ad3c8c8fab6887f153938eb04b86d59
GTMOAuth2: c77fe325e4acd453837e72d91e3b5f13116857b2
GTMSessionFetcher: 0c4baf0a73acd0041bf9f71ea018deedab5ea84e
leveldb-library: 08cba283675b7ed2d99629a4bc5fd052cd2bb6a5
nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3
Protobuf: 1eb9700044745f00181c136ef21b8ff3ad5a0fd5
React: 1fe0eb13d90b625d94c3b117c274dcfd2e760e11
RNFirebase: 2b25fd2e60269f26bb0a76c71dcc942b35a77df0
yoga: b1ce48b6cf950b98deae82838f5173ea7cf89e85
PODFILE CHECKSUM: 33388e8d8d1b7c967a58d636efdd0c9f4d74a9b5
COCOAPODS: 1.5.3

File diff suppressed because it is too large Load Diff

View File

@ -1,131 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
BuildableName = "libReact.a"
BlueprintName = "React"
ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "testing.app"
BlueprintName = "testing"
ReferencedContainer = "container:testing.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "exampleTests.xctest"
BlueprintName = "exampleTests"
ReferencedContainer = "container:testing.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "exampleTests.xctest"
BlueprintName = "exampleTests"
ReferencedContainer = "container:testing.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "testing.app"
BlueprintName = "testing"
ReferencedContainer = "container:testing.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "testing.app"
BlueprintName = "testing"
ReferencedContainer = "container:testing.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "testing.app"
BlueprintName = "testing"
ReferencedContainer = "container:testing.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1,132 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
BuildableName = "libReact.a"
BlueprintName = "React"
ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "testing.app"
BlueprintName = "testing"
ReferencedContainer = "container:testing.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "exampleTests.xctest"
BlueprintName = "exampleTests"
ReferencedContainer = "container:testing.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "exampleTests.xctest"
BlueprintName = "exampleTests"
ReferencedContainer = "container:testing.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "testing.app"
BlueprintName = "testing"
ReferencedContainer = "container:testing.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "testing.app"
BlueprintName = "testing"
ReferencedContainer = "container:testing.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "testing.app"
BlueprintName = "testing"
ReferencedContainer = "container:testing.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
customArchiveName = "testing"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:testing.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>

View File

@ -1,16 +0,0 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (nonatomic, strong) UIWindow *window;
@end

View File

@ -1,39 +0,0 @@
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
//#import <RNFirebaseNotifications.h>
@import Firebase;
@import GoogleSignIn;
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIRApp configure];
[GIDSignIn sharedInstance].clientID = [FIRApp defaultApp].options.clientID;
NSURL *jsCodeLocation;
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"testing"
initialProperties:nil
launchOptions:launchOptions];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
//- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
//fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
// [[RNFirebaseNotifications instance] didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
//}
@end

View File

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="NO">
<dependencies>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="testing" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
</document>

View File

@ -1,53 +0,0 @@
{
"images": [
{
"idiom": "iphone",
"size": "20x20",
"scale": "2x"
},
{
"idiom": "iphone",
"size": "20x20",
"scale": "3x"
},
{
"idiom": "iphone",
"size": "29x29",
"scale": "2x"
},
{
"idiom": "iphone",
"size": "29x29",
"scale": "3x"
},
{
"idiom": "iphone",
"size": "40x40",
"scale": "2x"
},
{
"idiom": "iphone",
"size": "40x40",
"scale": "3x"
},
{
"idiom": "iphone",
"size": "60x60",
"scale": "2x"
},
{
"idiom": "iphone",
"size": "60x60",
"scale": "3x"
},
{
"idiom": "ios-marketing",
"size": "1024x1024",
"scale": "1x"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}

View File

@ -1,64 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.17067372085-siujfe334vool17t2mtrmjrsgl81nhd9</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>location</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>

View File

@ -1,18 +0,0 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.testing</string>
</array>
</dict>
</plist>

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -1,70 +0,0 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import <React/RCTLog.h>
#import <React/RCTRootView.h>
#define TIMEOUT_SECONDS 600
#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
@interface exampleTests : XCTestCase
@end
@implementation exampleTests
- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
{
if (test(view)) {
return YES;
}
for (UIView *subview in [view subviews]) {
if ([self findSubviewInView:subview matching:test]) {
return YES;
}
}
return NO;
}
- (void)testRendersWelcomeScreen
{
UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
BOOL foundElement = NO;
__block NSString *redboxError = nil;
RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
if (level >= RCTLogLevelError) {
redboxError = message;
}
});
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
return YES;
}
return NO;
}];
}
RCTSetLogFunction(RCTDefaultLogFunction);
XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
}
@end

12387
bridge/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,108 +0,0 @@
{
"name": "rnfirebase-tests",
"version": "0.0.1",
"private": true,
"scripts": {
"packager-chrome": "node node_modules/react-native/local-cli/cli.js start --platforms ios,android",
"packager-bridge": "REACT_DEBUGGER='echo nope' node node_modules/react-native/local-cli/cli.js start --platforms ios,android",
"packager-bridge-reset-cache": "REACT_DEBUGGER='echo nope' node node_modules/react-native/local-cli/cli.js start --platforms ios,android --reset-cache",
"build-android": "detox build --configuration android.emu.debug",
"build-ios": "detox build --configuration ios.sim.debug",
"test": "npm run test-android && test-ios",
"test-android": "detox test --configuration android.emu.debug",
"test-android-reuse": "detox test --configuration android.emu.debug --reuse",
"test-android-cover": "nyc detox test --configuration android.emu.debug",
"test-android-cover-reuse": "nyc detox test --configuration android.emu.debug --reuse",
"test-ios": "detox test --configuration ios.sim.debug --loglevel warn",
"test-ios-reuse": "detox test --configuration ios.sim.debug --reuse --loglevel warn",
"test-ios-cover": "nyc detox test --configuration ios.sim.debug",
"test-ios-cover-reuse": "nyc detox test --configuration ios.sim.debug --reuse --loglevel warn",
"ios:pod:install": "cd ios && rm -rf ReactNativeFirebaseDemo.xcworkspace && pod install && cd .."
},
"dependencies": {
"jet": "0.0.2",
"detox": "^8.1.1",
"fbjs": "^0.8.16",
"firebase-admin": "^5.12.0",
"jsonwebtoken": "^8.2.1",
"mocha": "^5.2.0",
"prop-types": "^15.6.1",
"react": "^16.4.1",
"react-native": "^0.56.0",
"should": "^13.2.1",
"should-sinon": "0.0.6",
"sinon": "^6.1.4"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.47",
"@babel/core": "7.0.0-beta.47",
"babel-eslint": "^8.2.6",
"babel-plugin-istanbul": "^5.0.1",
"babel-plugin-module-resolver": "^3.1.1",
"babel-preset-react-native": "^5.0.2",
"eslint": "^5.3.0",
"eslint-config-airbnb": "^17.0.0",
"eslint-plugin-flowtype": "^2.46.3",
"eslint-plugin-import": "^2.11.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
"flow-bin": "^0.78.0",
"nyc": "^12.0.2",
"rimraf": "^2.6.2"
},
"nyc": {
"check-coverage": false,
"lines": 95,
"statements": 95,
"functions": 95,
"branches": 95,
"include": [
"**/dist/**"
],
"exclude": [
"node_modules",
"**/dist/utils/emitter**",
"**/dist/modules/admob**",
"**/dist/modules/auth/phone**"
],
"sourceMap": true,
"instrument": true,
"cwd": "..",
"reporter": [
"lcov",
"text-summary"
]
},
"detox": {
"test-runner": "mocha",
"specs": "e2e",
"runner-config": "e2e/mocha.opts",
"configurations": {
"ios.sim.release": {
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/testing.app",
"build": "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/testing.xcworkspace -scheme testing -configuration Release -sdk iphonesimulator -derivedDataPath ios/build -quiet",
"type": "ios.simulator",
"name": "iPhone 7 Plus"
},
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/testing.app",
"build": "xcodebuild -workspace ios/testing.xcworkspace -scheme testing -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 7 Plus",
"logLevel": "error"
},
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "pushd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && popd",
"type": "android.emulator",
"name": "TestingAVD"
},
"android.emu.release": {
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
"build": "pushd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && popd",
"type": "android.emulator",
"name": "TestingAVD"
}
}
}
}

View File

@ -1,28 +0,0 @@
const { resolve } = require('path');
let metroBundler;
try {
metroBundler = require('metro');
} catch (ex) {
metroBundler = require('metro-bundler');
}
const blacklist = metroBundler.createBlacklist;
module.exports = {
getProjectRoots() {
return [__dirname, resolve(__dirname, '..')];
},
getProvidesModuleNodeModules() {
return ['react-native', 'react', 'prop-types', 'fbjs'];
},
getBlacklistRE() {
return blacklist([
new RegExp(`^${escape(resolve(__dirname, '..', 'node_modules'))}\\/.*$`),
new RegExp(`^${escape(resolve(__dirname, '..', 'tests'))}\\/.*$`),
new RegExp(
`^${escape(resolve(__dirname, '..', 'tests', 'node_modules'))}\\/.*$`
),
]);
},
};