remove old tests app - no longer in use / migrated to bridge
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"presets": [
|
||||
"react-native"
|
||||
],
|
||||
"env": {
|
||||
"development": {
|
||||
"plugins": [
|
||||
["istanbul", {
|
||||
"include": [
|
||||
"**/firebase/**.js"
|
||||
]
|
||||
}]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
|
||||
[android]
|
||||
target = Google Inc.:Google APIs:23
|
||||
|
||||
[maven_repositories]
|
||||
central = https://repo1.maven.org/maven2
|
|
@ -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
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
[ignore]
|
||||
; We fork some components by platform
|
||||
.*/*[.]android.js
|
||||
|
||||
; Ignore "BUCK" generated dirs
|
||||
<PROJECT_ROOT>/\.buckd/
|
||||
|
||||
; Ignore unexpected extra "@providesModule"
|
||||
.*/node_modules/.*/node_modules/fbjs/.*
|
||||
|
||||
; Ignore duplicate module providers
|
||||
; For RN Apps installed via npm, "Libraries" folder is inside
|
||||
; "node_modules/react-native" but in the source repo it is in the root
|
||||
.*/Libraries/react-native/React.js
|
||||
|
||||
; Ignore polyfills
|
||||
.*/Libraries/polyfills/.*
|
||||
|
||||
; Ignore metro
|
||||
.*/node_modules/metro/.*
|
||||
|
||||
[include]
|
||||
|
||||
[libs]
|
||||
node_modules/react-native/Libraries/react-native/react-native-interface.js
|
||||
node_modules/react-native/flow/
|
||||
node_modules/react-native/flow-github/
|
||||
|
||||
[options]
|
||||
emoji=true
|
||||
|
||||
module.system=haste
|
||||
|
||||
munge_underscores=true
|
||||
|
||||
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'
|
||||
|
||||
module.file_ext=.js
|
||||
module.file_ext=.jsx
|
||||
module.file_ext=.json
|
||||
module.file_ext=.native.js
|
||||
|
||||
suppress_type=$FlowIssue
|
||||
suppress_type=$FlowFixMe
|
||||
suppress_type=$FlowFixMeProps
|
||||
suppress_type=$FlowFixMeState
|
||||
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
|
||||
|
||||
[version]
|
||||
^0.65.0
|
|
@ -1 +0,0 @@
|
|||
*.pbxproj -text
|
|
@ -1,2 +0,0 @@
|
|||
__tests__/build/
|
||||
ios/build/
|
|
@ -1 +0,0 @@
|
|||
{}
|
|
@ -1 +0,0 @@
|
|||
See https://rnfirebase.io/docs/master/testing
|
|
@ -1,287 +0,0 @@
|
|||
import 'should-sinon';
|
||||
|
||||
import TestSuite from '../lib/TestSuite';
|
||||
|
||||
function asynchronousHooksTests({ it: _it, describe: _describe }) {
|
||||
_describe('before hooks:', () => {
|
||||
_it('can return a promise that is resolved before executing other hooks and tests', async () => {
|
||||
let valueBySecondHook = null;
|
||||
let valueByTest = null;
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, before }) => {
|
||||
let resolved = false;
|
||||
|
||||
before(() => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolved = true;
|
||||
resolve();
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
|
||||
before(() => {
|
||||
valueBySecondHook = resolved;
|
||||
});
|
||||
|
||||
it('', () => {
|
||||
valueByTest = resolved;
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
valueBySecondHook.should.equal(true);
|
||||
valueByTest.should.equal(true);
|
||||
});
|
||||
|
||||
_it('can be an asynchronous function that is awaited before executing other hooks and tests', async () => {
|
||||
let valueBySecondHook = null;
|
||||
let valueByTest = null;
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, before }) => {
|
||||
let resolved = false;
|
||||
|
||||
before(async () => {
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolved = true;
|
||||
resolve();
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
|
||||
before(() => {
|
||||
valueBySecondHook = resolved;
|
||||
});
|
||||
|
||||
it('', () => {
|
||||
valueByTest = resolved;
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
valueBySecondHook.should.equal(true);
|
||||
valueByTest.should.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
_describe('beforeEach hooks:', () => {
|
||||
_it('can return a promise that is resolved before executing other hooks and tests', async () => {
|
||||
let valueBySecondHook = null;
|
||||
let valueByTest = null;
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, beforeEach }) => {
|
||||
let resolved = false;
|
||||
|
||||
beforeEach(() => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolved = true;
|
||||
resolve();
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
valueBySecondHook = resolved;
|
||||
});
|
||||
|
||||
it('', () => {
|
||||
valueByTest = resolved;
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
valueBySecondHook.should.equal(true);
|
||||
valueByTest.should.equal(true);
|
||||
});
|
||||
|
||||
_it('can be an asynchronous function that is awaited before executing other hooks and tests', async () => {
|
||||
let valueBySecondHook = null;
|
||||
let valueByTest = null;
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, beforeEach }) => {
|
||||
let resolved = false;
|
||||
|
||||
beforeEach(async () => {
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolved = true;
|
||||
resolve();
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
valueBySecondHook = resolved;
|
||||
});
|
||||
|
||||
it('', () => {
|
||||
valueByTest = resolved;
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
valueBySecondHook.should.equal(true);
|
||||
valueByTest.should.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
_describe('afterEach hooks:', () => {
|
||||
_it('can return a promise that is resolved before executing other hooks and tests', async () => {
|
||||
let valueBySecondHook = null;
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, afterEach }) => {
|
||||
let resolved = false;
|
||||
|
||||
afterEach(() => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolved = true;
|
||||
resolve();
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
valueBySecondHook = resolved;
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
valueBySecondHook.should.equal(true);
|
||||
});
|
||||
|
||||
_it('can be an asynchronous function that is awaited before executing other hooks and tests', async () => {
|
||||
let valueBySecondHook = null;
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, afterEach }) => {
|
||||
let resolved = false;
|
||||
|
||||
afterEach(async () => {
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolved = true;
|
||||
resolve();
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
valueBySecondHook = resolved;
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
valueBySecondHook.should.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
_describe('after hooks:', () => {
|
||||
_it('can return a promise that is resolved before executing other hooks and tests', async () => {
|
||||
let valueBySecondHook = null;
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, after }) => {
|
||||
let resolved = false;
|
||||
|
||||
after(() => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolved = true;
|
||||
resolve();
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
|
||||
after(() => {
|
||||
valueBySecondHook = resolved;
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
valueBySecondHook.should.equal(true);
|
||||
});
|
||||
|
||||
_it('can be an asynchronous function that is awaited before executing other hooks and tests', async () => {
|
||||
let valueBySecondHook = null;
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, after }) => {
|
||||
let resolved = false;
|
||||
|
||||
after(async () => {
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolved = true;
|
||||
resolve();
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
|
||||
after(() => {
|
||||
valueBySecondHook = resolved;
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
valueBySecondHook.should.equal(true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default asynchronousHooksTests;
|
|
@ -1,661 +0,0 @@
|
|||
import 'should-sinon';
|
||||
|
||||
import TestSuite from '../lib/TestSuite';
|
||||
|
||||
function failingHookTests({ it: _it, describe: _describe }) {
|
||||
_describe('before hooks:', () => {
|
||||
_it('capture promise rejections and marks all tests as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, before }) => {
|
||||
before(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
reject('failure');
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('2 tests has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" before Hook: failure');
|
||||
});
|
||||
|
||||
_it('capture errors thrown in promises and marks all tests as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, before }) => {
|
||||
before(() => {
|
||||
return new Promise(() => {
|
||||
true.should.equal(false);
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('2 tests has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" before Hook: AssertionError: expected true to be false');
|
||||
});
|
||||
|
||||
_it('captures errors thrown in asynchronous functions and marks all tests as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, before }) => {
|
||||
before(async () => {
|
||||
await new Promise(() => {
|
||||
true.should.equal(false);
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('2 tests has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" before Hook: AssertionError: expected true to be false');
|
||||
});
|
||||
|
||||
_it('captures errors thrown in synchronous functions and marks all tests as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, before }) => {
|
||||
before(() => {
|
||||
true.should.equal(false);
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('2 tests has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" before Hook: AssertionError: expected true to be false');
|
||||
});
|
||||
});
|
||||
|
||||
_describe('beforeEach hooks:', () => {
|
||||
_it('capture promise rejections and marks test that follows as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
let testRuns = 0;
|
||||
|
||||
testSuite.addTests(({ it, beforeEach }) => {
|
||||
beforeEach(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (testRuns > 0) {
|
||||
reject('failure');
|
||||
} else {
|
||||
testRuns += 1;
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" beforeEach Hook: failure');
|
||||
});
|
||||
|
||||
_it('capture errors thrown in promises and marks test that follows as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
let testRuns = 0;
|
||||
|
||||
testSuite.addTests(({ it, beforeEach }) => {
|
||||
beforeEach(() => {
|
||||
return new Promise((resolve) => {
|
||||
if (testRuns > 0) {
|
||||
true.should.equal(false);
|
||||
} else {
|
||||
testRuns += 1;
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" beforeEach Hook: AssertionError: expected true to be false');
|
||||
});
|
||||
|
||||
_it('captures errors thrown in asynchronous functions and marks test that follows as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
let testRuns = 0;
|
||||
|
||||
testSuite.addTests(({ it, beforeEach }) => {
|
||||
beforeEach(async () => {
|
||||
await new Promise((resolve) => {
|
||||
if (testRuns > 0) {
|
||||
true.should.equal(false);
|
||||
} else {
|
||||
testRuns += 1;
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" beforeEach Hook: AssertionError: expected true to be false');
|
||||
});
|
||||
|
||||
_it('captures errors thrown in synchronous functions and marks test that follows as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
let testRuns = 0;
|
||||
|
||||
testSuite.addTests(({ it, beforeEach }) => {
|
||||
beforeEach(() => {
|
||||
if (testRuns > 0) {
|
||||
true.should.equal(false);
|
||||
} else {
|
||||
testRuns += 1;
|
||||
}
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" beforeEach Hook: AssertionError: expected true to be false');
|
||||
});
|
||||
});
|
||||
|
||||
_describe('afterEach hooks:', () => {
|
||||
_it('capture promise rejections and marks test that proceeded as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
let testRuns = 0;
|
||||
|
||||
testSuite.addTests(({ it, afterEach }) => {
|
||||
afterEach(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (testRuns > 0) {
|
||||
reject('failure');
|
||||
} else {
|
||||
testRuns += 1;
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" afterEach Hook: failure');
|
||||
});
|
||||
|
||||
_it('capture errors thrown in promises and marks test that proceeded as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
let testRuns = 0;
|
||||
|
||||
testSuite.addTests(({ it, afterEach }) => {
|
||||
afterEach(() => {
|
||||
return new Promise((resolve) => {
|
||||
if (testRuns > 0) {
|
||||
true.should.equal(false);
|
||||
} else {
|
||||
testRuns += 1;
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" afterEach Hook: AssertionError: expected true to be false');
|
||||
});
|
||||
|
||||
_it('captures errors thrown in asynchronous functions and marks test that proceeded as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
let testRuns = 0;
|
||||
|
||||
testSuite.addTests(({ it, afterEach }) => {
|
||||
afterEach(async () => {
|
||||
await new Promise((resolve) => {
|
||||
if (testRuns > 0) {
|
||||
true.should.equal(false);
|
||||
} else {
|
||||
testRuns += 1;
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" afterEach Hook: AssertionError: expected true to be false');
|
||||
});
|
||||
|
||||
_it('captures errors thrown in synchronous functions and marks test that proceeded as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
let testRuns = 0;
|
||||
|
||||
testSuite.addTests(({ it, afterEach }) => {
|
||||
afterEach(() => {
|
||||
if (testRuns > 0) {
|
||||
true.should.equal(false);
|
||||
} else {
|
||||
testRuns += 1;
|
||||
}
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" afterEach Hook: AssertionError: expected true to be false');
|
||||
});
|
||||
});
|
||||
|
||||
_describe('after hooks:', () => {
|
||||
_it('capture promise rejections and marks all tests as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, after }) => {
|
||||
after(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
reject('failure');
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('2 tests has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" after Hook: failure');
|
||||
});
|
||||
|
||||
_it('capture errors thrown in promises and marks all tests as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, after }) => {
|
||||
after(() => {
|
||||
return new Promise(() => {
|
||||
true.should.equal(false);
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('2 tests has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" after Hook: AssertionError: expected true to be false');
|
||||
});
|
||||
|
||||
_it('captures errors thrown in asynchronous functions and marks all tests as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, after }) => {
|
||||
after(async () => {
|
||||
await new Promise(() => {
|
||||
true.should.equal(false);
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('2 tests has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" after Hook: AssertionError: expected true to be false');
|
||||
});
|
||||
|
||||
_it('captures errors thrown in synchronous functions and marks all tests as failed', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, after }) => {
|
||||
after(() => {
|
||||
true.should.equal(false);
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('2 tests has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" after Hook: AssertionError: expected true to be false');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default failingHookTests;
|
|
@ -1,278 +0,0 @@
|
|||
import sinon from 'sinon';
|
||||
import 'should-sinon';
|
||||
|
||||
import TestSuite from '../lib/TestSuite';
|
||||
|
||||
function hookScopeTests({ it: _it, describe: _describe }) {
|
||||
_describe('before hooks:', () => {
|
||||
_it('apply only to the scope they are defined in and any child scopes', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
let value = 0;
|
||||
let valueWhenOtherTestRuns = null;
|
||||
let valueWhenSiblingTestRuns = null;
|
||||
let valueWhenChildTestRuns = null;
|
||||
|
||||
testSuite.addTests(({ it, before, context }) => {
|
||||
context('', () => {
|
||||
before(() => {
|
||||
value = 1;
|
||||
});
|
||||
|
||||
it('', () => {
|
||||
valueWhenSiblingTestRuns = value;
|
||||
});
|
||||
|
||||
context('', () => {
|
||||
it('', () => {
|
||||
valueWhenChildTestRuns = value;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => {
|
||||
valueWhenOtherTestRuns = value;
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
valueWhenOtherTestRuns.should.equal(0);
|
||||
valueWhenSiblingTestRuns.should.equal(1);
|
||||
valueWhenChildTestRuns.should.equal(1);
|
||||
});
|
||||
|
||||
_it('only run once for the scope they apply', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const beforeHook = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ it, before, context }) => {
|
||||
context('', () => {
|
||||
before(beforeHook);
|
||||
|
||||
it('', () => { });
|
||||
|
||||
context('', () => {
|
||||
it('', () => { });
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
beforeHook.should.be.calledOnce();
|
||||
});
|
||||
});
|
||||
|
||||
_describe('beforeEach hooks:', () => {
|
||||
_it('apply only to the scope they are defined in and any child scopes', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
let value = 0;
|
||||
let valueWhenOtherTestRuns = null;
|
||||
let valueWhenSiblingTestRuns = null;
|
||||
let valueWhenChildTestRuns = null;
|
||||
|
||||
testSuite.addTests(({ it, beforeEach, context }) => {
|
||||
context('', () => {
|
||||
beforeEach(() => {
|
||||
value = 1;
|
||||
});
|
||||
|
||||
it('', () => {
|
||||
valueWhenSiblingTestRuns = value;
|
||||
});
|
||||
|
||||
context('', () => {
|
||||
it('', () => {
|
||||
valueWhenChildTestRuns = value;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => {
|
||||
valueWhenOtherTestRuns = value;
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
valueWhenOtherTestRuns.should.equal(0);
|
||||
valueWhenSiblingTestRuns.should.equal(1);
|
||||
valueWhenChildTestRuns.should.equal(1);
|
||||
});
|
||||
|
||||
_it('are called once for every test in its scope', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const beforeEachHook = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ it, beforeEach, context }) => {
|
||||
context('', () => {
|
||||
beforeEach(beforeEachHook);
|
||||
|
||||
it('', () => { });
|
||||
|
||||
context('', () => {
|
||||
it('', () => { });
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
beforeEachHook.should.be.calledTwice();
|
||||
});
|
||||
});
|
||||
|
||||
_describe('afterEach hooks:', () => {
|
||||
_it('apply only to the scope they are defined in and any child scopes', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
let value = 0;
|
||||
|
||||
testSuite.addTests(({ it, afterEach, context }) => {
|
||||
context('', () => {
|
||||
it('', () => {
|
||||
value += 1;
|
||||
});
|
||||
|
||||
context('', () => {
|
||||
it('', () => {
|
||||
value += 1;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
value -= 1;
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => {
|
||||
value += 1;
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
value.should.equal(1);
|
||||
});
|
||||
|
||||
_it('are called once for every test in its scope', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const afterEachHook = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ it, afterEach, context }) => {
|
||||
context('', () => {
|
||||
afterEach(afterEachHook);
|
||||
|
||||
it('', () => { });
|
||||
|
||||
context('', () => {
|
||||
it('', () => { });
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
afterEachHook.should.be.calledTwice();
|
||||
});
|
||||
});
|
||||
|
||||
_describe('after hooks:', () => {
|
||||
_it('apply only to the scope they are defined in and any child scopes', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
let value = 0;
|
||||
|
||||
testSuite.addTests(({ it, after, context }) => {
|
||||
context('', () => {
|
||||
it('', () => {
|
||||
value += 1;
|
||||
});
|
||||
|
||||
context('', () => {
|
||||
it('', () => {
|
||||
value += 1;
|
||||
});
|
||||
});
|
||||
|
||||
after(() => {
|
||||
value -= 1;
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => {
|
||||
value += 1;
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
value.should.equal(2);
|
||||
});
|
||||
|
||||
_it('are called once for every test in its scope', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const afterHook = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ it, after, context }) => {
|
||||
context('', () => {
|
||||
it('', () => { });
|
||||
|
||||
context('', () => {
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
after(afterHook);
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
afterHook.should.be.calledOnce();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default hookScopeTests;
|
|
@ -1,310 +0,0 @@
|
|||
import sinon from 'sinon';
|
||||
import 'should-sinon';
|
||||
import assert from 'assert';
|
||||
|
||||
import TestSuite from '../lib/TestSuite';
|
||||
|
||||
function hooksCallOrderTests({ it: _it, describe: _describe }) {
|
||||
_describe('before hooks:', () => {
|
||||
_it('calls before hooks defined in the same context in the order they are defined', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
const beforeCallbackA = sinon.spy();
|
||||
const beforeCallbackB = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ it, before }) => {
|
||||
before(beforeCallbackA);
|
||||
before(beforeCallbackB);
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
beforeCallbackA.should.have.been.called();
|
||||
beforeCallbackB.should.have.been.called();
|
||||
|
||||
assert(beforeCallbackB.calledAfter(beforeCallbackA));
|
||||
});
|
||||
|
||||
_it('calls before hooks defined in child contexts after those in parent contexts', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
const beforeCallbackA = sinon.spy();
|
||||
const beforeCallbackB = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ it, before, context }) => {
|
||||
before(beforeCallbackA);
|
||||
|
||||
context('', () => {
|
||||
before(beforeCallbackB);
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
beforeCallbackA.should.have.been.called();
|
||||
beforeCallbackB.should.have.been.called();
|
||||
|
||||
assert(beforeCallbackB.calledAfter(beforeCallbackA));
|
||||
});
|
||||
});
|
||||
|
||||
_describe('beforeEach hooks:', () => {
|
||||
_it('calls beforeEach hooks defined in the same context in the order they are defined', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
const beforeEachCallbackA = sinon.spy();
|
||||
const beforeEachCallbackB = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ it, beforeEach }) => {
|
||||
beforeEach(beforeEachCallbackA);
|
||||
beforeEach(beforeEachCallbackB);
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
beforeEachCallbackA.should.have.been.called();
|
||||
beforeEachCallbackB.should.have.been.called();
|
||||
|
||||
assert(beforeEachCallbackB.calledAfter(beforeEachCallbackA));
|
||||
});
|
||||
|
||||
_it('calls beforeEach hooks defined in child contexts after those in parent contexts', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
const beforeEachCallbackA = sinon.spy();
|
||||
const beforeEachCallbackB = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ it, beforeEach, context }) => {
|
||||
beforeEach(beforeEachCallbackA);
|
||||
|
||||
context('', () => {
|
||||
beforeEach(beforeEachCallbackB);
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
beforeEachCallbackA.should.have.been.called();
|
||||
beforeEachCallbackB.should.have.been.called();
|
||||
|
||||
assert(beforeEachCallbackB.calledAfter(beforeEachCallbackA));
|
||||
});
|
||||
|
||||
_it('calls beforeEach hooks after before hooks', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
const beforeCallbackA = sinon.spy();
|
||||
const beforeEachCallbackB = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ it, before, beforeEach }) => {
|
||||
before(beforeCallbackA);
|
||||
beforeEach(beforeEachCallbackB);
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
beforeCallbackA.should.have.been.called();
|
||||
beforeEachCallbackB.should.have.been.called();
|
||||
|
||||
assert(beforeEachCallbackB.calledAfter(beforeCallbackA));
|
||||
});
|
||||
});
|
||||
|
||||
_describe('after hooks:', () => {
|
||||
_it('calls after hooks defined in the same context in the order they are defined', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
const afterCallbackA = sinon.spy();
|
||||
const afterCallbackB = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ it, after }) => {
|
||||
after(afterCallbackA);
|
||||
after(afterCallbackB);
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
afterCallbackA.should.have.been.called();
|
||||
afterCallbackB.should.have.been.called();
|
||||
|
||||
assert(afterCallbackB.calledAfter(afterCallbackA));
|
||||
});
|
||||
|
||||
_it('calls after hooks defined in child contexts before those in parent contexts', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
const afterCallbackA = sinon.spy();
|
||||
const afterCallbackB = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ it, after, context }) => {
|
||||
after(afterCallbackA);
|
||||
|
||||
context('', () => {
|
||||
after(afterCallbackB);
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
afterCallbackA.should.have.been.called();
|
||||
afterCallbackB.should.have.been.called();
|
||||
|
||||
assert(afterCallbackA.calledAfter(afterCallbackB));
|
||||
});
|
||||
});
|
||||
|
||||
_describe('afterEach hooks:', () => {
|
||||
_it('calls afterEach hooks defined in the same context in the order they are defined', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
const afterEachCallbackA = sinon.spy();
|
||||
const afterEachCallbackB = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ it, afterEach }) => {
|
||||
afterEach(afterEachCallbackA);
|
||||
afterEach(afterEachCallbackB);
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
afterEachCallbackA.should.have.been.called();
|
||||
afterEachCallbackB.should.have.been.called();
|
||||
|
||||
assert(afterEachCallbackB.calledAfter(afterEachCallbackA));
|
||||
});
|
||||
|
||||
_it('calls afterEach hooks defined in child contexts before those in parent contexts', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
const afterEachCallbackA = sinon.spy();
|
||||
const afterEachCallbackB = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ it, afterEach, context }) => {
|
||||
afterEach(afterEachCallbackA);
|
||||
|
||||
context('', () => {
|
||||
afterEach(afterEachCallbackB);
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
afterEachCallbackA.should.have.been.called();
|
||||
afterEachCallbackB.should.have.been.called();
|
||||
|
||||
assert(afterEachCallbackA.calledAfter(afterEachCallbackB));
|
||||
});
|
||||
|
||||
_it('calls afterEach hooks before after hooks', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
const afterCallbackA = sinon.spy();
|
||||
const afterEachCallbackB = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ it, after, afterEach }) => {
|
||||
after(afterCallbackA);
|
||||
afterEach(afterEachCallbackB);
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
afterCallbackA.should.have.been.called();
|
||||
afterEachCallbackB.should.have.been.called();
|
||||
|
||||
assert(afterCallbackA.calledAfter(afterEachCallbackB));
|
||||
});
|
||||
});
|
||||
|
||||
_describe('when there are no tests in a context or any of its children', () => {
|
||||
_it('then doesn\'t call any hooks', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
const beforeCallback = sinon.spy();
|
||||
const beforeEachCallback = sinon.spy();
|
||||
const afterCallback = sinon.spy();
|
||||
const afterEachCallback = sinon.spy();
|
||||
|
||||
testSuite.addTests(({ before, beforeEach, after, afterEach, context }) => {
|
||||
context('', () => {
|
||||
before(beforeCallback);
|
||||
beforeEach(beforeEachCallback);
|
||||
afterEach(afterEachCallback);
|
||||
after(afterCallback);
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
beforeCallback.should.not.have.been.called();
|
||||
beforeEachCallback.should.not.have.been.called();
|
||||
afterEachCallback.should.not.have.been.called();
|
||||
afterCallback.should.not.have.been.called();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default hooksCallOrderTests;
|
|
@ -1,17 +0,0 @@
|
|||
import TestSuite from '../lib/TestSuite';
|
||||
|
||||
import hooksCallOrderTest from './hooksCallOrderTests';
|
||||
import asynchronousHooksTests from './asynchronousHooksTests';
|
||||
import hookScopeTests from './hookScopeTests';
|
||||
import failingHookTests from './failingHookTests';
|
||||
import timingOutHookTests from './timingOutHookTests';
|
||||
|
||||
const suite = new TestSuite('Internal', 'Lifecycle methods', {});
|
||||
|
||||
suite.addTests(hooksCallOrderTest);
|
||||
suite.addTests(asynchronousHooksTests);
|
||||
suite.addTests(hookScopeTests);
|
||||
suite.addTests(failingHookTests);
|
||||
suite.addTests(timingOutHookTests);
|
||||
|
||||
export default suite;
|
|
@ -1,327 +0,0 @@
|
|||
import 'should-sinon';
|
||||
|
||||
import TestSuite from '../lib/TestSuite';
|
||||
|
||||
function failingHookTests({ it: _it, describe: _describe }) {
|
||||
_describe('before hooks:', () => {
|
||||
_it('timeout after 5 seconds by default', { timeout: 7000 }, async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, before }) => {
|
||||
before(() => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, 6000);
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" before Hook: TimeoutError: before hook took longer than 5000ms. This can be extended with the timeout option.');
|
||||
});
|
||||
|
||||
_it('allows manually setting timeout', { timeout: 7000 }, async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, before }) => {
|
||||
before({ timeout: 500 }, () => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, 600);
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" before Hook: TimeoutError: before hook took longer than 500ms. This can be extended with the timeout option.');
|
||||
});
|
||||
});
|
||||
|
||||
_describe('beforeEach hooks:', () => {
|
||||
_it('timeout after 5 seconds by default', { timeout: 7000 }, async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, beforeEach }) => {
|
||||
beforeEach(() => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, 6000);
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" beforeEach Hook: TimeoutError: beforeEach hook took longer than 5000ms. This can be extended with the timeout option.');
|
||||
});
|
||||
|
||||
_it('allows manually setting timeout', { timeout: 7000 }, async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, beforeEach }) => {
|
||||
beforeEach({ timeout: 500 }, () => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, 600);
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" beforeEach Hook: TimeoutError: beforeEach hook took longer than 500ms. This can be extended with the timeout option.');
|
||||
});
|
||||
});
|
||||
|
||||
_describe('afterEach hooks:', () => {
|
||||
_it('timeout after 5 seconds by default', { timeout: 7000 }, async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, afterEach }) => {
|
||||
afterEach(() => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, 6000);
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" afterEach Hook: TimeoutError: afterEach hook took longer than 5000ms. This can be extended with the timeout option.');
|
||||
});
|
||||
|
||||
_it('allows manually setting timeout', { timeout: 7000 }, async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, afterEach }) => {
|
||||
afterEach({ timeout: 500 }, () => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, 600);
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" afterEach Hook: TimeoutError: afterEach hook took longer than 500ms. This can be extended with the timeout option.');
|
||||
});
|
||||
});
|
||||
|
||||
_describe('after hooks:', () => {
|
||||
_it('timeout after 5 seconds by default', { timeout: 7000 }, async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, after }) => {
|
||||
after(() => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, 6000);
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" after Hook: TimeoutError: after hook took longer than 5000ms. This can be extended with the timeout option.');
|
||||
});
|
||||
|
||||
_it('allows manually setting timeout', { timeout: 7000 }, async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it, after }) => {
|
||||
after({ timeout: 500 }, () => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, 600);
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => { });
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('Error occurred in "" after Hook: TimeoutError: after hook took longer than 500ms. This can be extended with the timeout option.');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default failingHookTests;
|
|
@ -1,75 +0,0 @@
|
|||
import 'babel-core/register';
|
||||
import 'babel-polyfill';
|
||||
import Promise from 'bluebird';
|
||||
import 'colors';
|
||||
|
||||
import RunStatus from './lib/RunStatus';
|
||||
import LifeCycleTestSuite from './hooks/index';
|
||||
import TestsTestSuite from './tests/index';
|
||||
|
||||
let successfulTests = 0;
|
||||
let failingTests = 0;
|
||||
const testErrors = {};
|
||||
|
||||
const suites = [
|
||||
LifeCycleTestSuite,
|
||||
TestsTestSuite,
|
||||
];
|
||||
|
||||
suites.forEach((suite) => {
|
||||
suite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (testSuiteAction) => {
|
||||
if (testSuiteAction.message) {
|
||||
console.error(testSuiteAction.message.red);
|
||||
testErrors[suite.description] = {
|
||||
message: testSuiteAction.message,
|
||||
stackTrace: testSuiteAction.stackTrace,
|
||||
};
|
||||
}
|
||||
},
|
||||
(testAction) => {
|
||||
const test = suite.testDefinitions.tests[testAction.testId];
|
||||
const testContext = suite.testDefinitions.testContexts[test.testContextId];
|
||||
|
||||
const description = (() => {
|
||||
if (testContext.name && !test.description.startsWith(testContext.name)) {
|
||||
return `${testContext.name} ${test.description}`;
|
||||
}
|
||||
|
||||
return test.description;
|
||||
})();
|
||||
|
||||
if (testAction.status === RunStatus.OK) {
|
||||
console.log(` ✅ ${description}`.green);
|
||||
successfulTests += 1;
|
||||
} else if (testAction.status === RunStatus.ERR) {
|
||||
console.log(` ❌ ${description}`.red);
|
||||
testErrors[test.description] = {
|
||||
message: testAction.message,
|
||||
stackTrace: testAction.stackTrace,
|
||||
};
|
||||
failingTests += 1;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Promise.each(suites, (suite) => {
|
||||
console.log(`\n\n${suite.name} ${suite.description}:\n\r`);
|
||||
return suite.run();
|
||||
}).then(() => {
|
||||
console.log(`\n${successfulTests} tests passed.`);
|
||||
|
||||
if (failingTests) {
|
||||
console.log(`${failingTests} tests failed.`);
|
||||
}
|
||||
|
||||
if (Object.keys(testErrors).length > 0) {
|
||||
console.log('\nErrors:'.red);
|
||||
|
||||
Object.keys(testErrors).forEach((failingTestDescription) => {
|
||||
const error = testErrors[failingTestDescription];
|
||||
console.error(`\n${failingTestDescription}: ${error.message} \n${error.stackTrace}`.red);
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,82 +0,0 @@
|
|||
import 'should-sinon';
|
||||
|
||||
import TestSuite from '../lib/TestSuite';
|
||||
|
||||
function asynchronousTestTests({ it: _it, describe: _describe }) {
|
||||
_describe('tests', () => {
|
||||
_it('can return a promise that is resolved before executing hooks and other tests', async () => {
|
||||
let valueBySecondTest = null;
|
||||
let valueByHook = null;
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, after }) => {
|
||||
let resolved = false;
|
||||
|
||||
it('', () => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolved = true;
|
||||
resolve();
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => {
|
||||
valueBySecondTest = resolved;
|
||||
});
|
||||
|
||||
after(() => {
|
||||
valueByHook = resolved;
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
valueBySecondTest.should.equal(true);
|
||||
valueByHook.should.equal(true);
|
||||
});
|
||||
|
||||
_it('can be an asynchronous function that is awaited before executing hooks and other tests', async () => {
|
||||
let valueBySecondTest = null;
|
||||
let valueByHook = null;
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, after }) => {
|
||||
let resolved = false;
|
||||
|
||||
it('', async () => {
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolved = true;
|
||||
resolve();
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
|
||||
it('', () => {
|
||||
valueBySecondTest = resolved;
|
||||
});
|
||||
|
||||
after(() => {
|
||||
valueByHook = resolved;
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
valueBySecondTest.should.equal(true);
|
||||
valueByHook.should.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
export default asynchronousTestTests;
|
|
@ -1,146 +0,0 @@
|
|||
import 'should-sinon';
|
||||
|
||||
import TestSuite from '../lib/TestSuite';
|
||||
|
||||
function failingTestTests({ it: _it, describe: _describe }) {
|
||||
_describe('running a test that is a function that returns a promise', () => {
|
||||
_it('correctly reports a failure when the promise is rejected', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it }) => {
|
||||
it('', () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
reject('failure');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('failure');
|
||||
});
|
||||
|
||||
_it('correctly reports a failure when an error is thrown', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it }) => {
|
||||
|
||||
it('', () => {
|
||||
return new Promise(() => {
|
||||
false.should.equal(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('AssertionError: expected false to be true');
|
||||
});
|
||||
});
|
||||
|
||||
_describe('running an async function test', () => {
|
||||
_it('correctly reports a failure when an error is thrown', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it }) => {
|
||||
it('', async () => {
|
||||
false.should.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('AssertionError: expected false to be true');
|
||||
});
|
||||
});
|
||||
|
||||
_describe('running an synchronous function test', () => {
|
||||
_it('correctly reports a failure when an error is thrown', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it }) => {
|
||||
it('', () => {
|
||||
false.should.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('AssertionError: expected false to be true');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default failingTestTests;
|
|
@ -1,84 +0,0 @@
|
|||
import sinon from 'sinon';
|
||||
import 'should-sinon';
|
||||
|
||||
import TestSuite from '../lib/TestSuite';
|
||||
|
||||
function focusedTestTests({ it: _it, describe: _describe }) {
|
||||
_describe('when fit is used instead of it', () => {
|
||||
_it('a test is marked as focused', async () => {
|
||||
const focusedTest = sinon.spy();
|
||||
const otherTest = sinon.spy();
|
||||
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, fit }) => {
|
||||
fit('', focusedTest);
|
||||
|
||||
it('', otherTest);
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run(Object.keys(testSuite.testDefinitions.focusedTestIds));
|
||||
|
||||
focusedTest.should.be.called();
|
||||
otherTest.should.not.be.called();
|
||||
});
|
||||
});
|
||||
|
||||
_describe('when fdescribe is used instead of describe', () => {
|
||||
_it('child tests are marked as focused', async () => {
|
||||
const focusedTest = sinon.spy();
|
||||
const otherTest = sinon.spy();
|
||||
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, fdescribe }) => {
|
||||
fdescribe('', () => {
|
||||
it('', focusedTest);
|
||||
});
|
||||
|
||||
it('', otherTest);
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run(Object.keys(testSuite.testDefinitions.focusedTestIds));
|
||||
|
||||
focusedTest.should.be.called();
|
||||
otherTest.should.not.be.called();
|
||||
});
|
||||
});
|
||||
|
||||
_describe('when fcontext is used instead of context', () => {
|
||||
_it('child tests are marked as focused', async () => {
|
||||
const focusedTest = sinon.spy();
|
||||
const otherTest = sinon.spy();
|
||||
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, fcontext }) => {
|
||||
fcontext('', () => {
|
||||
it('', focusedTest);
|
||||
});
|
||||
|
||||
it('', otherTest);
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
await testSuite.run(Object.keys(testSuite.testDefinitions.focusedTestIds));
|
||||
|
||||
focusedTest.should.be.called();
|
||||
otherTest.should.not.be.called();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default focusedTestTests;
|
|
@ -1,17 +0,0 @@
|
|||
import TestSuite from '../lib/TestSuite';
|
||||
|
||||
import asynchronousTestTests from './asynchronousTestTests';
|
||||
import focusedTestTests from './focusedTestTests';
|
||||
import pendingTestTests from './pendingTestTests';
|
||||
import failingTestTests from './failingTestTests';
|
||||
import timingOutTests from './timingOutTests';
|
||||
|
||||
const suite = new TestSuite('Internal', 'Test Definitions', {});
|
||||
|
||||
suite.addTests(asynchronousTestTests);
|
||||
suite.addTests(focusedTestTests);
|
||||
suite.addTests(pendingTestTests);
|
||||
suite.addTests(failingTestTests);
|
||||
suite.addTests(timingOutTests);
|
||||
|
||||
export default suite;
|
|
@ -1,186 +0,0 @@
|
|||
import sinon from 'sinon';
|
||||
import 'should-sinon';
|
||||
|
||||
import TestSuite from '../lib/TestSuite';
|
||||
|
||||
function pendingTestTests({ it: _it, describe: _describe }) {
|
||||
_describe('when xit is used instead of it', () => {
|
||||
_it('a test is marked as pending', async () => {
|
||||
const pendingTest = sinon.spy();
|
||||
const otherTest = sinon.spy();
|
||||
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, xit }) => {
|
||||
xit('', pendingTest);
|
||||
|
||||
it('', otherTest);
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
const testIdsToRun = Object.keys(testSuite.testDefinitions.tests).reduce((memo, testId) => {
|
||||
if (!testSuite.testDefinitions.pendingTestIds[testId]) {
|
||||
memo.push(testId);
|
||||
}
|
||||
|
||||
return memo;
|
||||
}, []);
|
||||
|
||||
await testSuite.run(testIdsToRun);
|
||||
|
||||
pendingTest.should.not.be.called();
|
||||
otherTest.should.be.called();
|
||||
});
|
||||
});
|
||||
|
||||
_describe('when xdescribe is used instead of describe', () => {
|
||||
_it('child tests are marked as pending', async () => {
|
||||
const pendingTest = sinon.spy();
|
||||
const otherTest = sinon.spy();
|
||||
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, xdescribe }) => {
|
||||
xdescribe('', () => {
|
||||
it('', pendingTest);
|
||||
});
|
||||
|
||||
it('', otherTest);
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
const testIdsToRun = Object.keys(testSuite.testDefinitions.tests).reduce((memo, testId) => {
|
||||
if (!testSuite.testDefinitions.pendingTestIds[testId]) {
|
||||
memo.push(testId);
|
||||
}
|
||||
|
||||
return memo;
|
||||
}, []);
|
||||
|
||||
await testSuite.run(testIdsToRun);
|
||||
|
||||
pendingTest.should.not.be.called();
|
||||
otherTest.should.be.called();
|
||||
});
|
||||
});
|
||||
|
||||
_describe('when xcontext is used instead of context', () => {
|
||||
_it('child tests are marked as pending', async () => {
|
||||
const pendingTest = sinon.spy();
|
||||
const otherTest = sinon.spy();
|
||||
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ it, xcontext }) => {
|
||||
xcontext('', () => {
|
||||
it('', pendingTest);
|
||||
});
|
||||
|
||||
it('', otherTest);
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
const testIdsToRun = Object.keys(testSuite.testDefinitions.tests).reduce((memo, testId) => {
|
||||
if (!testSuite.testDefinitions.pendingTestIds[testId]) {
|
||||
memo.push(testId);
|
||||
}
|
||||
|
||||
return memo;
|
||||
}, []);
|
||||
|
||||
await testSuite.run(testIdsToRun);
|
||||
|
||||
pendingTest.should.not.be.called();
|
||||
otherTest.should.be.called();
|
||||
});
|
||||
});
|
||||
|
||||
_describe('when an outer context is focused', () => {
|
||||
_it('a pending test will still not run', async () => {
|
||||
const pendingTest = sinon.spy();
|
||||
const otherTest = sinon.spy();
|
||||
const unfocusedTest = sinon.spy();
|
||||
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ fdescribe, it, xit }) => {
|
||||
fdescribe('', () => {
|
||||
xit('', pendingTest);
|
||||
|
||||
it('', otherTest);
|
||||
});
|
||||
|
||||
it('', unfocusedTest);
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
const testIdsToRun = Object.keys(testSuite.testDefinitions.focusedTestIds).reduce((memo, testId) => {
|
||||
if (!testSuite.testDefinitions.pendingTestIds[testId]) {
|
||||
memo.push(testId);
|
||||
}
|
||||
|
||||
return memo;
|
||||
}, []);
|
||||
|
||||
await testSuite.run(testIdsToRun);
|
||||
|
||||
pendingTest.should.not.be.called();
|
||||
otherTest.should.be.called();
|
||||
unfocusedTest.should.not.be.called();
|
||||
});
|
||||
});
|
||||
|
||||
_describe('when an outer context is focused', () => {
|
||||
_it('a pending context will still not run', async () => {
|
||||
const pendingTest = sinon.spy();
|
||||
const otherTest = sinon.spy();
|
||||
const unfocusedTest = sinon.spy();
|
||||
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
|
||||
testSuite.addTests(({ fdescribe, it, xdescribe }) => {
|
||||
fdescribe('', () => {
|
||||
xdescribe('', () => {
|
||||
it('', pendingTest);
|
||||
});
|
||||
|
||||
it('', otherTest);
|
||||
});
|
||||
|
||||
it('', unfocusedTest);
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
});
|
||||
|
||||
const testIdsToRun = Object.keys(testSuite.testDefinitions.focusedTestIds).reduce((memo, testId) => {
|
||||
if (!testSuite.testDefinitions.pendingTestIds[testId]) {
|
||||
memo.push(testId);
|
||||
}
|
||||
|
||||
return memo;
|
||||
}, []);
|
||||
|
||||
await testSuite.run(testIdsToRun);
|
||||
|
||||
pendingTest.should.not.be.called();
|
||||
otherTest.should.be.called();
|
||||
unfocusedTest.should.not.be.called();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default pendingTestTests;
|
|
@ -1,84 +0,0 @@
|
|||
|
||||
import 'should-sinon';
|
||||
|
||||
import TestSuite from '../lib/TestSuite';
|
||||
|
||||
function timingOutTests({ it: _it, describe: _describe }) {
|
||||
_describe('tests', () => {
|
||||
_it('time out after 5 seconds by default', { timeout: 7000 }, async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it }) => {
|
||||
it('', () => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, 6000);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('TimeoutError: Test took longer than 5000ms. This can be extended with the timeout option.');
|
||||
});
|
||||
|
||||
_it('can set custom timeout', async () => {
|
||||
const testSuite = new TestSuite('', '', {});
|
||||
const testSuiteStatuses = [];
|
||||
const testStatuses = [];
|
||||
|
||||
testSuite.addTests(({ it }) => {
|
||||
it('', { timeout: 500 }, () => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
testSuite.setStore({
|
||||
getState: () => { return {}; },
|
||||
}, (value) => {
|
||||
testSuiteStatuses.push(value);
|
||||
}, (value) => {
|
||||
testStatuses.push(value);
|
||||
});
|
||||
|
||||
await testSuite.run();
|
||||
|
||||
const lastTestSuiteStatus = testSuiteStatuses[testSuiteStatuses.length - 1];
|
||||
|
||||
lastTestSuiteStatus.progress.should.equal(100);
|
||||
lastTestSuiteStatus.status.should.equal('error');
|
||||
lastTestSuiteStatus.message.should.equal('1 test has error(s).');
|
||||
|
||||
const lastTestStatus = testStatuses[testStatuses.length - 1];
|
||||
|
||||
lastTestStatus.status.should.equal('error');
|
||||
lastTestStatus.message.should.equal('TimeoutError: Test took longer than 500ms. This can be extended with the timeout option.');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default timingOutTests;
|
|
@ -1,65 +0,0 @@
|
|||
# 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__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
|
||||
lib_deps.append(':' + name)
|
||||
prebuilt_jar(
|
||||
name = name,
|
||||
binary_jar = jarfile,
|
||||
)
|
||||
|
||||
for aarfile in glob(['libs/*.aar']):
|
||||
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
|
||||
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.react-native-firebase-tests",
|
||||
)
|
||||
|
||||
android_resource(
|
||||
name = "res",
|
||||
package = "com.react-native-firebase-tests",
|
||||
res = "src/main/res",
|
||||
)
|
||||
|
||||
android_binary(
|
||||
name = "app",
|
||||
keystore = "//android/keystores:debug",
|
||||
manifest = "src/main/AndroidManifest.xml",
|
||||
package_type = "debug",
|
||||
deps = [
|
||||
":app-code",
|
||||
],
|
||||
)
|
|
@ -1,109 +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"
|
||||
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
|
||||
|
||||
/**
|
||||
* Set this to true to create two separate APKs instead of one:
|
||||
* - An APK that only works on ARM devices
|
||||
* - An APK that only works on x86 devices
|
||||
* The advantage is the size of the APK is reduced by about 4MB.
|
||||
* Upload all the APKs to the Play Store and people will download
|
||||
* the correct one based on the CPU architecture of their device.
|
||||
*/
|
||||
def enableSeparateBuildPerCPUArchitecture = false
|
||||
|
||||
/**
|
||||
* Run Proguard to shrink the Java bytecode in release builds.
|
||||
*/
|
||||
def enableProguardInReleaseBuilds = false
|
||||
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
buildToolsVersion '27.0.3'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.reactnativefirebasedemo"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 26
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "x86"
|
||||
}
|
||||
multiDexEnabled true
|
||||
}
|
||||
splits {
|
||||
abi {
|
||||
reset()
|
||||
enable enableSeparateBuildPerCPUArchitecture
|
||||
universalApk false // If true, also generate a universal APK
|
||||
include "armeabi-v7a", "x86"
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled enableProguardInReleaseBuilds
|
||||
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
||||
}
|
||||
}
|
||||
// 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':react-native-vector-icons')
|
||||
implementation project(':react-native-firebase')
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') {
|
||||
transitive = true
|
||||
}
|
||||
|
||||
// RNFirebase required dependencies
|
||||
implementation "com.google.firebase:firebase-core:16.0.1"
|
||||
implementation "com.google.android.gms:play-services-base:15.0.1"
|
||||
|
||||
// RNFirebase optional dependencies
|
||||
implementation "com.google.firebase:firebase-ads:15.0.1"
|
||||
implementation "com.google.firebase:firebase-auth:16.0.2"
|
||||
implementation "com.google.firebase:firebase-config:16.0.0"
|
||||
implementation "com.google.firebase:firebase-crash:16.0.1"
|
||||
implementation "com.google.firebase:firebase-database:16.0.1"
|
||||
implementation "com.google.firebase:firebase-firestore:17.0.2"
|
||||
implementation "com.google.firebase:firebase-functions:16.0.1"
|
||||
implementation "com.google.firebase:firebase-invites:16.0.1"
|
||||
implementation "com.google.firebase:firebase-storage:16.0.1"
|
||||
implementation "com.google.firebase:firebase-messaging:17.0.0"
|
||||
implementation "com.google.firebase:firebase-perf:16.0.0"
|
||||
|
||||
implementation "com.android.support:appcompat-v7:27.0.2"
|
||||
implementation "com.facebook.react:react-native:+" // From node_modules
|
||||
}
|
||||
|
||||
// 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'
|
|
@ -1,42 +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-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"
|
||||
}
|
|
@ -1,70 +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
|
||||
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
|
||||
|
||||
# Do not strip any method/class that is annotated with @DoNotStrip
|
||||
-keep @com.facebook.proguard.annotations.DoNotStrip class *
|
||||
-keep @com.facebook.common.internal.DoNotStrip class *
|
||||
-keepclassmembers class * {
|
||||
@com.facebook.proguard.annotations.DoNotStrip *;
|
||||
@com.facebook.common.internal.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.**
|
||||
|
||||
# TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
|
||||
# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
|
||||
-dontwarn android.text.StaticLayout
|
||||
|
||||
# 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.**
|
|
@ -1,67 +0,0 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.reactnativefirebasedemo">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
android:allowBackup="true"
|
||||
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">
|
||||
<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:enabled="true" android:exported="true" android:name="io.invertase.firebase.notifications.RNFirebaseNotificationsRebootReceiver">
|
||||
<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=".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 android:autoVerify="true">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:host="je786.app.goo.gl" android:scheme="http"/>
|
||||
<data android:host="je786.app.goo.gl" android:scheme="https"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
|
||||
</application>
|
||||
</manifest>
|
|
@ -1,80 +0,0 @@
|
|||
package com.reactnativefirebasedemo;
|
||||
|
||||
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 "ReactNativeFirebaseDemo";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
checkWindowPerms();
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
package com.reactnativefirebasedemo;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.facebook.react.ReactApplication;
|
||||
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.crash.RNFirebaseCrashPackage;
|
||||
import io.invertase.firebase.database.RNFirebaseDatabasePackage;
|
||||
import io.invertase.firebase.fabric.crashlytics.RNFirebaseCrashlyticsPackage;
|
||||
import io.invertase.firebase.firestore.RNFirebaseFirestorePackage;
|
||||
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 com.oblador.vectoricons.VectorIconsPackage;
|
||||
import com.facebook.react.ReactNativeHost;
|
||||
import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.shell.MainReactPackage;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
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 VectorIconsPackage(),
|
||||
new RNFirebasePackage(),
|
||||
new RNFirebaseAdMobPackage(),
|
||||
new RNFirebaseAnalyticsPackage(),
|
||||
new RNFirebaseAuthPackage(),
|
||||
new RNFirebaseRemoteConfigPackage(),
|
||||
new RNFirebaseCrashPackage(),
|
||||
new RNFirebaseCrashlyticsPackage(),
|
||||
new RNFirebaseDatabasePackage(),
|
||||
new RNFirebaseFirestorePackage(),
|
||||
new RNFirebaseInstanceIdPackage(),
|
||||
new RNFirebaseInvitesPackage(),
|
||||
new RNFirebaseLinksPackage(),
|
||||
new RNFirebaseMessagingPackage(),
|
||||
new RNFirebaseNotificationsPackage(),
|
||||
new RNFirebasePerformancePackage(),
|
||||
new RNFirebaseStoragePackage()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getJSMainModuleName() {
|
||||
return "index";
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public ReactNativeHost getReactNativeHost() {
|
||||
return mReactNativeHost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
SoLoader.init(this, /* native exopackage */ false);
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 16 KiB |
|
@ -1,3 +0,0 @@
|
|||
<resources>
|
||||
<string name="app_name">ReactNativeFirebaseDemo</string>
|
||||
</resources>
|
|
@ -1,8 +0,0 @@
|
|||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
|
@ -1,52 +0,0 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
maven {
|
||||
url 'https://maven.fabric.io/public'
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.2'
|
||||
classpath 'com.google.gms:google-services:4.0.1'
|
||||
classpath 'com.google.firebase:firebase-plugins:1.1.1'
|
||||
classpath 'io.fabric.tools:gradle:1.25.4'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
google()
|
||||
jcenter()
|
||||
maven {
|
||||
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
||||
url "$rootDir/../node_modules/react-native/android"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
ext {
|
||||
compileSdk = 27
|
||||
buildTools = "27.0.3"
|
||||
minSdk = 16
|
||||
targetSdk = 26
|
||||
}
|
||||
|
||||
afterEvaluate { project ->
|
||||
if (!project.name.equalsIgnoreCase("app")
|
||||
&& project.hasProperty("android")) {
|
||||
android {
|
||||
compileSdkVersion compileSdk
|
||||
buildToolsVersion buildTools
|
||||
defaultConfig {
|
||||
minSdkVersion minSdk
|
||||
targetSdkVersion targetSdk
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,21 +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.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -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
|
||||
org.gradle.jvmargs=-Xmx1536M
|
|
@ -1,6 +0,0 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
#distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
|
@ -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 "$@"
|
|
@ -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
|
|
@ -1,8 +0,0 @@
|
|||
keystore(
|
||||
name = "debug",
|
||||
properties = "debug.keystore.properties",
|
||||
store = "debug.keystore",
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
],
|
||||
)
|
|
@ -1,4 +0,0 @@
|
|||
key.store=debug.keystore
|
||||
key.alias=androiddebugkey
|
||||
key.store.password=android
|
||||
key.alias.password=android
|
|
@ -1,7 +0,0 @@
|
|||
rootProject.name = 'ReactNativeFirebaseDemo'
|
||||
include ':react-native-firebase'
|
||||
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, './../../android')
|
||||
include ':react-native-vector-icons'
|
||||
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
|
||||
|
||||
include ':app'
|
Before Width: | Height: | Size: 21 KiB |
|
@ -1,10 +0,0 @@
|
|||
import { AppRegistry } from 'react-native';
|
||||
import bootstrap from './src/main';
|
||||
import bgMessaging from './src/bgMessaging';
|
||||
|
||||
AppRegistry.registerComponent('ReactNativeFirebaseDemo', () => bootstrap);
|
||||
// Task registered to handle background data-only FCM messages
|
||||
AppRegistry.registerHeadlessTask(
|
||||
'RNFirebaseBackgroundMessage',
|
||||
() => bgMessaging
|
||||
);
|
|
@ -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-22imndi01abc2p6esgtu1i1m9mqrd0ib.apps.googleusercontent.com</string>
|
||||
<key>REVERSED_CLIENT_ID</key>
|
||||
<string>com.googleusercontent.apps.305229645282-22imndi01abc2p6esgtu1i1m9mqrd0ib</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.invertase.ReactNativeFirebaseDemo</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/>
|
||||
<key>IS_ANALYTICS_ENABLED</key>
|
||||
<false/>
|
||||
<key>IS_APPINVITE_ENABLED</key>
|
||||
<false/>
|
||||
<key>IS_GCM_ENABLED</key>
|
||||
<true/>
|
||||
<key>IS_SIGNIN_ENABLED</key>
|
||||
<true/>
|
||||
<key>GOOGLE_APP_ID</key>
|
||||
<string>1:305229645282:ios:7b45748cb1117d2d</string>
|
||||
<key>DATABASE_URL</key>
|
||||
<string>https://rnfirebase-b9ad4.firebaseio.com</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,52 +0,0 @@
|
|||
install! 'cocoapods', :deterministic_uuids => false
|
||||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '8.0'
|
||||
|
||||
target 'ReactNativeFirebaseDemo' 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',
|
||||
'CxxBridge',
|
||||
'RCTText',
|
||||
'RCTNetwork',
|
||||
'RCTWebSocket',
|
||||
]
|
||||
|
||||
pod 'Firebase/AdMob'
|
||||
pod 'Firebase/Auth'
|
||||
pod 'Firebase/Core'
|
||||
pod 'Firebase/Crash'
|
||||
pod 'Firebase/Database'
|
||||
pod 'Firebase/DynamicLinks'
|
||||
pod 'Firebase/Firestore'
|
||||
pod 'Firebase/Invites'
|
||||
pod 'Firebase/Messaging'
|
||||
pod 'Firebase/RemoteConfig'
|
||||
pod 'Firebase/Storage'
|
||||
pod 'Firebase/Performance'
|
||||
pod 'Fabric', '~> 1.7.5'
|
||||
pod 'Crashlytics', '~> 3.10.1'
|
||||
|
||||
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
|
|
@ -1,307 +0,0 @@
|
|||
PODS:
|
||||
- boost-for-react-native (1.63.0)
|
||||
- BoringSSL (10.0.5):
|
||||
- BoringSSL/Implementation (= 10.0.5)
|
||||
- BoringSSL/Interface (= 10.0.5)
|
||||
- BoringSSL/Implementation (10.0.5):
|
||||
- BoringSSL/Interface (= 10.0.5)
|
||||
- BoringSSL/Interface (10.0.5)
|
||||
- Crashlytics (3.10.2):
|
||||
- Fabric (~> 1.7.7)
|
||||
- DoubleConversion (1.1.5)
|
||||
- Fabric (1.7.7)
|
||||
- Firebase/AdMob (5.3.0):
|
||||
- Firebase/Core
|
||||
- Google-Mobile-Ads-SDK (= 7.31.0)
|
||||
- Firebase/Auth (5.3.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseAuth (= 5.0.1)
|
||||
- Firebase/Core (5.3.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseAnalytics (= 5.0.1)
|
||||
- Firebase/CoreOnly (5.3.0):
|
||||
- FirebaseCore (= 5.0.4)
|
||||
- Firebase/Crash (5.3.0):
|
||||
- Firebase/Core
|
||||
- FirebaseCrash (= 3.0.0)
|
||||
- Firebase/Database (5.3.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseDatabase (= 5.0.1)
|
||||
- Firebase/DynamicLinks (5.3.0):
|
||||
- Firebase/Core
|
||||
- FirebaseDynamicLinks (= 3.0.1)
|
||||
- Firebase/Firestore (5.3.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseFirestore (= 0.12.4)
|
||||
- Firebase/Invites (5.3.0):
|
||||
- Firebase/Core
|
||||
- FirebaseInvites (= 3.0.0)
|
||||
- Firebase/Messaging (5.3.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseMessaging (= 3.0.2)
|
||||
- Firebase/Performance (5.3.0):
|
||||
- Firebase/Core
|
||||
- FirebasePerformance (= 2.0.1)
|
||||
- Firebase/RemoteConfig (5.3.0):
|
||||
- Firebase/Core
|
||||
- FirebaseRemoteConfig (= 3.0.0)
|
||||
- Firebase/Storage (5.3.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseStorage (= 3.0.0)
|
||||
- FirebaseABTesting (2.0.0):
|
||||
- FirebaseCore (~> 5.0)
|
||||
- Protobuf (~> 3.5)
|
||||
- FirebaseAnalytics (5.0.1):
|
||||
- FirebaseCore (~> 5.0)
|
||||
- FirebaseInstanceID (~> 3.0)
|
||||
- GoogleToolboxForMac/NSData+zlib (~> 2.1)
|
||||
- nanopb (~> 0.3)
|
||||
- FirebaseAuth (5.0.1):
|
||||
- FirebaseCore (~> 5.0)
|
||||
- GTMSessionFetcher/Core (~> 1.1)
|
||||
- FirebaseCore (5.0.4):
|
||||
- GoogleToolboxForMac/NSData+zlib (~> 2.1)
|
||||
- FirebaseCrash (3.0.0):
|
||||
- FirebaseAnalytics (~> 5.0)
|
||||
- FirebaseInstanceID (~> 3.0)
|
||||
- GoogleToolboxForMac/Logger (~> 2.1)
|
||||
- GoogleToolboxForMac/NSData+zlib (~> 2.1)
|
||||
- Protobuf (~> 3.5)
|
||||
- FirebaseDatabase (5.0.1):
|
||||
- FirebaseCore (~> 5.0)
|
||||
- leveldb-library (~> 1.18)
|
||||
- FirebaseDynamicLinks (3.0.1):
|
||||
- FirebaseAnalytics (~> 5.0)
|
||||
- FirebaseFirestore (0.12.4):
|
||||
- FirebaseCore (~> 5.0)
|
||||
- FirebaseFirestore/abseil-cpp (= 0.12.4)
|
||||
- gRPC-ProtoRPC (~> 1.0)
|
||||
- leveldb-library (~> 1.18)
|
||||
- Protobuf (~> 3.1)
|
||||
- FirebaseFirestore/abseil-cpp (0.12.4):
|
||||
- FirebaseCore (~> 5.0)
|
||||
- gRPC-ProtoRPC (~> 1.0)
|
||||
- leveldb-library (~> 1.18)
|
||||
- Protobuf (~> 3.1)
|
||||
- FirebaseInstanceID (3.1.1):
|
||||
- FirebaseCore (~> 5.0)
|
||||
- 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.0.2):
|
||||
- FirebaseCore (~> 5.0)
|
||||
- FirebaseInstanceID (~> 3.0)
|
||||
- GoogleToolboxForMac/Logger (~> 2.1)
|
||||
- Protobuf (~> 3.1)
|
||||
- FirebasePerformance (2.0.1):
|
||||
- FirebaseAnalytics (~> 5.0)
|
||||
- FirebaseInstanceID (~> 3.1)
|
||||
- FirebaseSwizzlingUtilities/ISASwizzling (~> 2.0)
|
||||
- FirebaseSwizzlingUtilities/MethodSwizzling (~> 2.0)
|
||||
- GoogleToolboxForMac/Logger (~> 2.1)
|
||||
- GoogleToolboxForMac/NSData+zlib (~> 2.1)
|
||||
- GTMSessionFetcher/Core (~> 1.1)
|
||||
- Protobuf (~> 3.5)
|
||||
- FirebaseRemoteConfig (3.0.0):
|
||||
- FirebaseABTesting (~> 2.0)
|
||||
- FirebaseAnalytics (~> 5.0)
|
||||
- FirebaseCore (~> 5.0)
|
||||
- FirebaseInstanceID (~> 3.0)
|
||||
- GoogleToolboxForMac/NSData+zlib (~> 2.1)
|
||||
- Protobuf (~> 3.5)
|
||||
- FirebaseStorage (3.0.0):
|
||||
- FirebaseCore (~> 5.0)
|
||||
- GTMSessionFetcher/Core (~> 1.1)
|
||||
- FirebaseSwizzlingUtilities/ISASwizzling (2.0.0)
|
||||
- FirebaseSwizzlingUtilities/MethodSwizzling (2.0.0):
|
||||
- FirebaseCore (~> 5.0)
|
||||
- Folly (2016.09.26.00):
|
||||
- boost-for-react-native
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- glog (0.3.4)
|
||||
- Google-Mobile-Ads-SDK (7.31.0)
|
||||
- GoogleAPIClientForREST (1.3.4):
|
||||
- GoogleAPIClientForREST/Core (= 1.3.4)
|
||||
- GTMSessionFetcher (>= 1.1.7)
|
||||
- GoogleAPIClientForREST/Core (1.3.4):
|
||||
- GTMSessionFetcher (>= 1.1.7)
|
||||
- GoogleSignIn (4.1.2):
|
||||
- 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)
|
||||
- gRPC (1.12.0):
|
||||
- gRPC-RxLibrary (= 1.12.0)
|
||||
- gRPC/Main (= 1.12.0)
|
||||
- gRPC-Core (1.12.0):
|
||||
- gRPC-Core/Implementation (= 1.12.0)
|
||||
- gRPC-Core/Interface (= 1.12.0)
|
||||
- gRPC-Core/Implementation (1.12.0):
|
||||
- BoringSSL (~> 10.0)
|
||||
- gRPC-Core/Interface (= 1.12.0)
|
||||
- nanopb (~> 0.3)
|
||||
- gRPC-Core/Interface (1.12.0)
|
||||
- gRPC-ProtoRPC (1.12.0):
|
||||
- gRPC (= 1.12.0)
|
||||
- gRPC-RxLibrary (= 1.12.0)
|
||||
- Protobuf (~> 3.0)
|
||||
- gRPC-RxLibrary (1.12.0)
|
||||
- gRPC/Main (1.12.0):
|
||||
- gRPC-Core (= 1.12.0)
|
||||
- gRPC-RxLibrary (= 1.12.0)
|
||||
- GTMOAuth2 (1.1.6):
|
||||
- GTMSessionFetcher (~> 1.1)
|
||||
- GTMSessionFetcher (1.1.15):
|
||||
- GTMSessionFetcher/Full (= 1.1.15)
|
||||
- GTMSessionFetcher/Core (1.1.15)
|
||||
- GTMSessionFetcher/Full (1.1.15):
|
||||
- GTMSessionFetcher/Core (= 1.1.15)
|
||||
- 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.0)
|
||||
- React (0.54.4):
|
||||
- React/Core (= 0.54.4)
|
||||
- React/Core (0.54.4):
|
||||
- yoga (= 0.54.4.React)
|
||||
- React/CxxBridge (0.54.4):
|
||||
- Folly (= 2016.09.26.00)
|
||||
- React/Core
|
||||
- React/cxxreact
|
||||
- React/cxxreact (0.54.4):
|
||||
- boost-for-react-native (= 1.63.0)
|
||||
- Folly (= 2016.09.26.00)
|
||||
- React/jschelpers
|
||||
- React/jsinspector
|
||||
- React/fishhook (0.54.4)
|
||||
- React/jschelpers (0.54.4):
|
||||
- Folly (= 2016.09.26.00)
|
||||
- React/PrivateDatabase
|
||||
- React/jsinspector (0.54.4)
|
||||
- React/PrivateDatabase (0.54.4)
|
||||
- React/RCTBlob (0.54.4):
|
||||
- React/Core
|
||||
- React/RCTNetwork (0.54.4):
|
||||
- React/Core
|
||||
- React/RCTText (0.54.4):
|
||||
- React/Core
|
||||
- React/RCTWebSocket (0.54.4):
|
||||
- React/Core
|
||||
- React/fishhook
|
||||
- React/RCTBlob
|
||||
- RNFirebase (4.2.0):
|
||||
- Firebase/Core
|
||||
- React
|
||||
- yoga (0.54.4.React)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Crashlytics (~> 3.10.1)
|
||||
- Fabric (~> 1.7.5)
|
||||
- Firebase/AdMob
|
||||
- Firebase/Auth
|
||||
- Firebase/Core
|
||||
- Firebase/Crash
|
||||
- Firebase/Database
|
||||
- Firebase/DynamicLinks
|
||||
- Firebase/Firestore
|
||||
- Firebase/Invites
|
||||
- Firebase/Messaging
|
||||
- Firebase/Performance
|
||||
- Firebase/RemoteConfig
|
||||
- Firebase/Storage
|
||||
- React/Core (from `../node_modules/react-native`)
|
||||
- React/CxxBridge (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`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
React:
|
||||
:path: ../node_modules/react-native
|
||||
RNFirebase:
|
||||
:path: ../../ios/RNFirebase.podspec
|
||||
yoga:
|
||||
:path: ../node_modules/react-native/ReactCommon/yoga
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
|
||||
BoringSSL: cf3f1793eb6e3c445c4d150456341f149c268a35
|
||||
Crashlytics: 0360624eea1c978a743feddb2fb1ef8b37fb7a0d
|
||||
DoubleConversion: e22e0762848812a87afd67ffda3998d9ef29170c
|
||||
Fabric: bda89e242bce1b7b8ab264248cf3407774ce0095
|
||||
Firebase: 68afeeb05461db02d7c9e3215cda28068670f4aa
|
||||
FirebaseABTesting: 1f50b8d50f5e3469eea54e7463a7b7fe221d1f5e
|
||||
FirebaseAnalytics: b3628aea54c50464c32c393fb2ea032566e7ecc2
|
||||
FirebaseAuth: 463b8ce33bd5d05f706dcd4615499e3212b4132b
|
||||
FirebaseCore: 62f1b792a49bb9e8b4073f24606d2c93ffc352f0
|
||||
FirebaseCrash: 8900571fd763fd5bdda04522ec53da979456e3ce
|
||||
FirebaseDatabase: 482bad9c2abd422bb2321194fb8c937e67426a89
|
||||
FirebaseDynamicLinks: d624a7adc81a8fd70d52be5a6a47a2bc0644b923
|
||||
FirebaseFirestore: 53f6fe858494c39dbfd5237655e0641152a88c89
|
||||
FirebaseInstanceID: f3f0657372592ecdfdfe2cac604a5a75758376a6
|
||||
FirebaseInvites: d7534f94d0610b892bac8ee0cf4218a14be46c28
|
||||
FirebaseMessaging: 6894b8fe0a0cf26c3b13dad729f1131654ae0bdb
|
||||
FirebasePerformance: 1ebd87ffee5ca814582db1dc9e25651792ba02db
|
||||
FirebaseRemoteConfig: 3c57e4644bd6976b671ae0b725cd709f198bd1f5
|
||||
FirebaseStorage: 7ca4bb7b58a25fa647b04f524033fc7cb7eb272b
|
||||
FirebaseSwizzlingUtilities: 6c22677c50d0b6f5f0dc637c1233f13694a3003f
|
||||
Folly: 211775e49d8da0ca658aebc8eab89d642935755c
|
||||
glog: 1de0bb937dccdc981596d3b5825ebfb765017ded
|
||||
Google-Mobile-Ads-SDK: 6e529e748b45507a2ca904e0b5a52669ba3920c4
|
||||
GoogleAPIClientForREST: f7951c455df271bc6259b3ddb4073d0026475ccf
|
||||
GoogleSignIn: d9ef55b10f0aa401a5de2747f59b725e4b9732ac
|
||||
GoogleToolboxForMac: 91c824d21e85b31c2aae9bb011c5027c9b4e738f
|
||||
gRPC: 9362451032695e2dfb7bafcd3740e3a27939e4ff
|
||||
gRPC-Core: 9696b220565b283e021cf2722d473a4a74b7622a
|
||||
gRPC-ProtoRPC: a1bd56fb1991a8dae4581250d7259eddabb66779
|
||||
gRPC-RxLibrary: 1ed5314e8b38cd6e55c9bfa048387136ae925ce9
|
||||
GTMOAuth2: c77fe325e4acd453837e72d91e3b5f13116857b2
|
||||
GTMSessionFetcher: 5fa5b80fd20e439ef5f545fb2cb3ca6c6714caa2
|
||||
leveldb-library: 08cba283675b7ed2d99629a4bc5fd052cd2bb6a5
|
||||
nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3
|
||||
Protobuf: 0fc0ad8bec688b2a3017a139953e01374fedbd5f
|
||||
React: c237e42de9c70e5cac6eeb52b4cfd3a0910c1f00
|
||||
RNFirebase: 2b25fd2e60269f26bb0a76c71dcc942b35a77df0
|
||||
yoga: 55da126afc384965b96bff46652464373b330add
|
||||
|
||||
PODFILE CHECKSUM: b776d6f4d08bbd51cda6d929b57bfaa8031e7ead
|
||||
|
||||
COCOAPODS: 1.4.0
|
|
@ -1,54 +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>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</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>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<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/>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string></string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
|
||||
<dict>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>localhost</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
|
@ -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>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</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>
|
|
@ -1,129 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0820"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "NO"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2D2A28121D9B038B00D4039D"
|
||||
BuildableName = "libReact.a"
|
||||
BlueprintName = "React-tvOS"
|
||||
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 = "2D02E47A1E0B4A5D006451C7"
|
||||
BuildableName = "ReactNativeFirebaseDemo-tvOS.app"
|
||||
BlueprintName = "ReactNativeFirebaseDemo-tvOS"
|
||||
ReferencedContainer = "container:ReactNativeFirebaseDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
|
||||
BuildableName = "ReactNativeFirebaseDemo-tvOSTests.xctest"
|
||||
BlueprintName = "ReactNativeFirebaseDemo-tvOSTests"
|
||||
ReferencedContainer = "container:ReactNativeFirebaseDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
|
||||
BuildableName = "ReactNativeFirebaseDemo-tvOSTests.xctest"
|
||||
BlueprintName = "ReactNativeFirebaseDemo-tvOSTests"
|
||||
ReferencedContainer = "container:ReactNativeFirebaseDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
|
||||
BuildableName = "ReactNativeFirebaseDemo-tvOS.app"
|
||||
BlueprintName = "ReactNativeFirebaseDemo-tvOS"
|
||||
ReferencedContainer = "container:ReactNativeFirebaseDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
|
||||
BuildableName = "ReactNativeFirebaseDemo-tvOS.app"
|
||||
BlueprintName = "ReactNativeFirebaseDemo-tvOS"
|
||||
ReferencedContainer = "container:ReactNativeFirebaseDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
|
||||
BuildableName = "ReactNativeFirebaseDemo-tvOS.app"
|
||||
BlueprintName = "ReactNativeFirebaseDemo-tvOS"
|
||||
ReferencedContainer = "container:ReactNativeFirebaseDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -1,131 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0620"
|
||||
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 = "ReactNativeFirebaseDemo.app"
|
||||
BlueprintName = "ReactNativeFirebaseDemo"
|
||||
ReferencedContainer = "container:ReactNativeFirebaseDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
|
||||
BuildableName = "ReactNativeFirebaseDemoTests.xctest"
|
||||
BlueprintName = "ReactNativeFirebaseDemoTests"
|
||||
ReferencedContainer = "container:ReactNativeFirebaseDemo.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 = "ReactNativeFirebaseDemoTests.xctest"
|
||||
BlueprintName = "ReactNativeFirebaseDemoTests"
|
||||
ReferencedContainer = "container:ReactNativeFirebaseDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
|
||||
BuildableName = "ReactNativeFirebaseDemo.app"
|
||||
BlueprintName = "ReactNativeFirebaseDemo"
|
||||
ReferencedContainer = "container:ReactNativeFirebaseDemo.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 = "ReactNativeFirebaseDemo.app"
|
||||
BlueprintName = "ReactNativeFirebaseDemo"
|
||||
ReferencedContainer = "container:ReactNativeFirebaseDemo.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 = "ReactNativeFirebaseDemo.app"
|
||||
BlueprintName = "ReactNativeFirebaseDemo"
|
||||
ReferencedContainer = "container:ReactNativeFirebaseDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -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
|
|
@ -1,48 +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 "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:@"ReactNativeFirebaseDemo"
|
||||
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
|
|
@ -1,42 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
|
||||
<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="ReactNativeFirebaseDemo" 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" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<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>
|
|
@ -1,79 +0,0 @@
|
|||
{
|
||||
"images": [
|
||||
{
|
||||
"size": "20x20",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon-20@2x.png",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"size": "20x20",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon-20@3x.png",
|
||||
"scale": "3x"
|
||||
},
|
||||
{
|
||||
"size": "29x29",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon-29.png",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"size": "29x29",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon-29@2x.png",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"size": "29x29",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon-29@3x.png",
|
||||
"scale": "3x"
|
||||
},
|
||||
{
|
||||
"size": "40x40",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon-40@2x.png",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"size": "40x40",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon-40@3x.png",
|
||||
"scale": "3x"
|
||||
},
|
||||
{
|
||||
"size": "57x57",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon-57.png",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"size": "57x57",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon-57@2x.png",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"size": "60x60",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon-60@2x.png",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"size": "60x60",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon-60@3x.png",
|
||||
"scale": "3x"
|
||||
},
|
||||
{
|
||||
"idiom": "ios-marketing",
|
||||
"size": "1024x1024",
|
||||
"scale": "1x"
|
||||
}
|
||||
],
|
||||
"info": {
|
||||
"version": 1,
|
||||
"author": "xcode"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 20 KiB |
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"info": {
|
||||
"version": 1,
|
||||
"author": "xcode"
|
||||
}
|
||||
}
|
|
@ -1,82 +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>com.invertase.RNFirebaseTests</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>LSApplicationCategoryType</key>
|
||||
<string></string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>localhost</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>NSContactsUsageDescription</key>
|
||||
<string>Needs access to your contacts to send invitations</string>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string></string>
|
||||
<key>UIAppFonts</key>
|
||||
<array>
|
||||
<string>Entypo.ttf</string>
|
||||
<string>EvilIcons.ttf</string>
|
||||
<string>FontAwesome.ttf</string>
|
||||
<string>Foundation.ttf</string>
|
||||
<string>Ionicons.ttf</string>
|
||||
<string>MaterialCommunityIcons.ttf</string>
|
||||
<string>MaterialIcons.ttf</string>
|
||||
<string>Octicons.ttf</string>
|
||||
<string>SimpleLineIcons.ttf</string>
|
||||
<string>Zocial.ttf</string>
|
||||
<string>Feather.ttf</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>
|
|
@ -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]));
|
||||
}
|
||||
}
|
|
@ -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>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</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>
|
|
@ -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 ReactNativeFirebaseDemoTests : XCTestCase
|
||||
|
||||
@end
|
||||
|
||||
@implementation ReactNativeFirebaseDemoTests
|
||||
|
||||
- (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 = [[[RCTSharedApplication() 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
|
|
@ -1,5 +0,0 @@
|
|||
module.exports = {
|
||||
RUNNING: 'running',
|
||||
OK: 'success',
|
||||
ERR: 'error',
|
||||
};
|
|
@ -1,242 +0,0 @@
|
|||
/**
|
||||
* Class that provides DSL for declaratively defining tests. Provides a declarative
|
||||
* interface for {@link TestSuiteDefinition} and only reveals methods that are part
|
||||
* of the test definition DSL.
|
||||
*/
|
||||
class TestDSL {
|
||||
/**
|
||||
* Create a new instance of TestDSL
|
||||
* @param {TestSuiteDefinition} testSuiteDefinition - Class to delegate the heavy lifting
|
||||
* of satisfying the DSL, to.
|
||||
* @param {Object} firebase - Object containing native and web firebase instances
|
||||
* @param {Object} firebase.native - Native firebase instance
|
||||
* @para {Object} firebase.web - Web firebase instance
|
||||
*/
|
||||
constructor(testSuiteDefinition, firebase) {
|
||||
this._testSuiteDefinition = testSuiteDefinition;
|
||||
|
||||
this.firebase = firebase;
|
||||
|
||||
this.after = this.after.bind(this);
|
||||
this.afterEach = this.afterEach.bind(this);
|
||||
|
||||
this.before = this.before.bind(this);
|
||||
this.beforeEach = this.beforeEach.bind(this);
|
||||
|
||||
this.describe = this.describe.bind(this);
|
||||
/** Alias for {@link TestDSL#describe } */
|
||||
this.context = this.describe;
|
||||
this.fdescribe = this.fdescribe.bind(this);
|
||||
/** Alias for {@link TestDSL#fdescribe } */
|
||||
this.fcontext = this.fdescribe;
|
||||
this.xdescribe = this.xdescribe.bind(this);
|
||||
/** Alias for {@link TestDSL#xdescribe } */
|
||||
this.xcontext = this.xdescribe;
|
||||
|
||||
this.tryCatch = this.tryCatch.bind(this);
|
||||
|
||||
this.it = this.it.bind(this);
|
||||
this.xit = this.xit.bind(this);
|
||||
this.fit = this.fit.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a function as a before hook to the current test context
|
||||
* @param {Object=} options - Options object
|
||||
* @param {Number=10000} options.timeout - Number of milliseconds before callback times
|
||||
* out
|
||||
* @param {Function} callback - Function to add as before hook to current test context
|
||||
*/
|
||||
before(options, callback = undefined) {
|
||||
const _options = callback ? options : {};
|
||||
const _callback = callback || options;
|
||||
|
||||
this._testSuiteDefinition.addBeforeHook(_callback, _options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a function as a before each hook to the current test context
|
||||
* @param {Object=} options - Options object
|
||||
* @param {Number=10000} options.timeout - Number of milliseconds before callback times
|
||||
* out
|
||||
* @param {Function} callback - Function to add as before each hook to current test
|
||||
* context
|
||||
*/
|
||||
beforeEach(options, callback = undefined) {
|
||||
const _options = callback ? options : {};
|
||||
const _callback = callback || options;
|
||||
|
||||
this._testSuiteDefinition.addBeforeEachHook(_callback, _options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a function as a after each hook to the current test context
|
||||
* @param {Object=} options - Options object
|
||||
* @param {Number=10000} options.timeout - Number of milliseconds before callback times
|
||||
* out
|
||||
* @param {Function} callback - Function to add as after each hook to current test context
|
||||
*/
|
||||
afterEach(options, callback = undefined) {
|
||||
const _options = callback ? options : {};
|
||||
const _callback = callback || options;
|
||||
|
||||
this._testSuiteDefinition.addAfterEachHook(_callback, _options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a function as a after hook to the current test context
|
||||
* @param {Object=} options - Options object
|
||||
* @param {Number=10000} options.timeout - Number of milliseconds before callback times
|
||||
* out
|
||||
* @param {Function} callback - Function to add as after hook to current test context
|
||||
*/
|
||||
after(options, callback = undefined) {
|
||||
const _options = callback ? options : {};
|
||||
const _callback = callback || options;
|
||||
|
||||
this._testSuiteDefinition.addAfterHook(_callback, _options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a new test context
|
||||
* @param {String} name - name of new test context
|
||||
* @param {ContextOptions} options - options for context
|
||||
* @param {Function} [testDefinitions={}] - function that defines further test contexts and
|
||||
* tests using the test DSL
|
||||
*/
|
||||
describe(name, options, testDefinitions) {
|
||||
let _testDefinitions;
|
||||
let _options;
|
||||
|
||||
if (testDefinitions) {
|
||||
_testDefinitions = testDefinitions;
|
||||
_options = options;
|
||||
} else {
|
||||
_testDefinitions = options;
|
||||
_options = {};
|
||||
}
|
||||
|
||||
this._testSuiteDefinition.pushTestContext(name, _options);
|
||||
_testDefinitions();
|
||||
this._testSuiteDefinition.popTestContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a new pending test context. Tests in a pending test context are not
|
||||
* run when the test suite is executed. They also appear greyed out.
|
||||
* @param {String} name - name of new test context
|
||||
* @param {ContextOptions} [options={}] - options for context
|
||||
* @param {Function} testDefinitions - function that defines further test contexts and
|
||||
* tests using the test DSL
|
||||
*/
|
||||
xdescribe(name, options, testDefinitions = undefined) {
|
||||
let _options = {};
|
||||
let _testDefinitions;
|
||||
|
||||
if (typeof options === 'function') {
|
||||
_options = { pending: true };
|
||||
_testDefinitions = options;
|
||||
} else {
|
||||
Object.assign(_options, options, { pending: true });
|
||||
_testDefinitions = testDefinitions;
|
||||
}
|
||||
|
||||
this.describe(name, _options, _testDefinitions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a new focused test context. Tests in a focused test context are the only
|
||||
* ones that appear and are run when the test suite is executed.
|
||||
* @param {String} name - name of new test context
|
||||
* @param {ContextOptions} [options={}] - options for context
|
||||
* @param {Function} testDefinitions - function that defines further test contexts and
|
||||
* tests using the test DSL
|
||||
*/
|
||||
fdescribe(name, options, testDefinitions = undefined) {
|
||||
let _options = {};
|
||||
let _testDefinitions;
|
||||
|
||||
if (typeof options === 'function') {
|
||||
_options = { focus: true };
|
||||
_testDefinitions = options;
|
||||
} else {
|
||||
Object.assign(_options, options, { focus: true });
|
||||
_testDefinitions = testDefinitions;
|
||||
}
|
||||
|
||||
this.describe(name, _options, _testDefinitions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a new test.
|
||||
* @param {String} description - Brief description of what the test expects
|
||||
* @param {TestOptions} options - Options of whether test should be focused or pending
|
||||
* @param {Function} testFunction - Body of the test containing setup and assertions
|
||||
*/
|
||||
it(description, options, testFunction = undefined) {
|
||||
this._testSuiteDefinition.addTest(description, options, testFunction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a new pending test. Pending tests are not run when the test suite is
|
||||
* executed. They also appear greyed out.
|
||||
* @param {String} description - Brief description of what the test expects
|
||||
* @param {ContextOptions} [options={}] - Options of whether test should be focused or pending
|
||||
* @param {Function} testFunction - Body of the test containing setup and assertions
|
||||
*/
|
||||
xit(description, options, testFunction = undefined) {
|
||||
let _options = {};
|
||||
let _testFunction;
|
||||
|
||||
if (typeof options === 'function') {
|
||||
_options = { pending: true };
|
||||
_testFunction = options;
|
||||
} else {
|
||||
Object.assign(_options, options, { pending: true });
|
||||
_testFunction = testFunction;
|
||||
}
|
||||
|
||||
this.it(description, _options, _testFunction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a new focused test. Focused tests are the only
|
||||
* ones that appear and are run when the test suite is executed.
|
||||
* @param {String} description - Brief description of what the test expects
|
||||
* @param {ContextOptions} [options={}] - Options of whether test should be focused or pending
|
||||
* @param {Function} testFunction - Body of the test containing setup and assertions
|
||||
*/
|
||||
fit(description, options, testFunction = undefined) {
|
||||
let _options = {};
|
||||
let _testFunction;
|
||||
|
||||
if (typeof options === 'function') {
|
||||
_options = { focus: true };
|
||||
_testFunction = options;
|
||||
} else {
|
||||
Object.assign(_options, options, { focus: true });
|
||||
_testFunction = testFunction;
|
||||
}
|
||||
|
||||
this.it(description, _options, _testFunction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries evaluating a function and calls a reject callback if it throws an error
|
||||
* @param {Function} callback - Function to evaluate
|
||||
* @param {Function} reject - Function to call if callback throws an error
|
||||
* @returns {function(...[*])} a function that will catch any errors thrown by callback,
|
||||
* passing them to reject instead.
|
||||
*/
|
||||
tryCatch(callback, reject) {
|
||||
return (...args) => {
|
||||
try {
|
||||
callback(...args);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export default TestDSL;
|
|
@ -1,518 +0,0 @@
|
|||
import Promise from 'bluebird';
|
||||
import RunStatus from './RunStatus';
|
||||
|
||||
const EVENTS = {
|
||||
TEST_SUITE_STATUS: 'TEST_SUITE_STATUS',
|
||||
TEST_STATUS: 'TEST_STATUS',
|
||||
};
|
||||
|
||||
if (!console.groupCollapsed) {
|
||||
console.groupCollapsed = console.log;
|
||||
console.groupEnd = () => console.log('');
|
||||
}
|
||||
|
||||
const locationRegex = /\(?http:.*:([0-9]+):([0-9]+)\)?/g;
|
||||
|
||||
function cleanStack(stack, maxLines = 5) {
|
||||
const lines = stack.split('\n').slice(0, maxLines + 1);
|
||||
const out = [];
|
||||
|
||||
for (let i = 0, len = lines.length; i < len; i++) {
|
||||
const srcLine = lines[i].trim();
|
||||
out.push(srcLine.replace(locationRegex, '()'));
|
||||
}
|
||||
|
||||
return out.join('\r\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Class that encapsulates synchronously running a suite's tests.
|
||||
*/
|
||||
class TestRun {
|
||||
/**
|
||||
* The number of tests that have been executed so far
|
||||
* @type {number}
|
||||
*/
|
||||
completedTests = 0;
|
||||
|
||||
/**
|
||||
* Creates a new TestRun
|
||||
* @param {TestSuite} testSuite - Test suite that tests belong to
|
||||
* @param {Test[]} tests - List of test to run
|
||||
* @param {TestSuiteDefinition} testDefinitions - Definition of tests and contexts
|
||||
*/
|
||||
constructor(testSuite, tests, testDefinitions) {
|
||||
this.testSuite = testSuite;
|
||||
|
||||
this.tests = tests;
|
||||
|
||||
this.rootContextId = testDefinitions.rootTestContextId;
|
||||
|
||||
this.testContexts = tests.reduce((memo, test) => {
|
||||
const { testContextId } = test;
|
||||
|
||||
this._recursivelyAddContextsTo(
|
||||
memo,
|
||||
testContextId,
|
||||
testDefinitions.testContexts
|
||||
);
|
||||
|
||||
memo[testContextId].tests.unshift(test);
|
||||
|
||||
return memo;
|
||||
}, {});
|
||||
|
||||
this.listeners = {
|
||||
[EVENTS.TEST_STATUS]: [],
|
||||
[EVENTS.TEST_SUITE_STATUS]: [],
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a listener for a change event
|
||||
* @param {String} action - one of the actions in EVENTS
|
||||
* @param {Function} callback - Callback that accepts event object
|
||||
*/
|
||||
onChange(action, callback) {
|
||||
this.listeners[action].push(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Walks up a context tree, copying test contexts from a source object to a target one.
|
||||
* Used for ensuring all of a test's parent contexts are added to the target object.
|
||||
* @param {Object<Number,TestContext>} target - Object to put test contexts in
|
||||
* @param {Number} id - Id of current context to add to target
|
||||
* @param {Object<Number,TestContext>} source - Object to get complete list of test contexts
|
||||
* from.
|
||||
* @param {Number} childContextId - id of child of current context
|
||||
* @private
|
||||
*/
|
||||
_recursivelyAddContextsTo(target, id, source, childContextId = null) {
|
||||
const testContext = source[id];
|
||||
|
||||
if (!target[id]) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
target[id] = {
|
||||
...testContext,
|
||||
tests: [],
|
||||
childContextIds: {},
|
||||
};
|
||||
}
|
||||
|
||||
if (childContextId) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
target[id].childContextIds[childContextId] = true;
|
||||
}
|
||||
|
||||
const { parentContextId } = testContext;
|
||||
|
||||
if (parentContextId) {
|
||||
this._recursivelyAddContextsTo(target, parentContextId, source, id);
|
||||
}
|
||||
}
|
||||
|
||||
_updateStatus(action, values) {
|
||||
const listeners = this.listeners[action];
|
||||
|
||||
listeners.forEach(listener => listener(values));
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the tests TestRun was initialised with.
|
||||
* @returns {Promise.<void>} Resolves once all the tests in the test suite have
|
||||
* completed running.
|
||||
*/
|
||||
async execute() {
|
||||
const store = this.testSuite.reduxStore;
|
||||
|
||||
if (!store) {
|
||||
testRuntimeError(
|
||||
`Failed to run ${
|
||||
this.testSuite.name
|
||||
} tests as no Redux store has been provided`
|
||||
);
|
||||
}
|
||||
|
||||
this._updateStatus(EVENTS.TEST_SUITE_STATUS, {
|
||||
suiteId: this.testSuite.id,
|
||||
status: RunStatus.RUNNING,
|
||||
|
||||
progress: 0,
|
||||
time: 0,
|
||||
});
|
||||
|
||||
// Start timing
|
||||
|
||||
this.runStartTime = Date.now();
|
||||
|
||||
const rootContext = this.testContexts[this.rootContextId];
|
||||
|
||||
if (rootContext) {
|
||||
await this._runTestsInContext(rootContext);
|
||||
|
||||
const errors = this.tests.filter(test => test.status === RunStatus.ERR);
|
||||
|
||||
if (errors.length) {
|
||||
this._updateStatus(EVENTS.TEST_SUITE_STATUS, {
|
||||
suiteId: this.testSuite.id,
|
||||
status: RunStatus.ERR,
|
||||
progress: 100,
|
||||
|
||||
time: Date.now() - this.runStartTime,
|
||||
message: `${errors.length} test${
|
||||
errors.length > 1 ? 's' : ''
|
||||
} has error(s).`,
|
||||
});
|
||||
} else {
|
||||
this._updateStatus(EVENTS.TEST_SUITE_STATUS, {
|
||||
suiteId: this.testSuite.id,
|
||||
status: RunStatus.OK,
|
||||
progress: 100,
|
||||
|
||||
time: Date.now() - this.runStartTime,
|
||||
message: '',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively enter a test context and run its before, beforeEach hooks where
|
||||
* appropriate; execute the test and then run afterEach and after hooks where
|
||||
* appropriate.
|
||||
* @param {TestContext} testContext - context to run hooks for
|
||||
* @param {Function[][]} beforeEachHooks - stack of beforeEach hooks defined
|
||||
* in parent contexts that should be run beforeEach test in child contexts
|
||||
* @param {Function[][]} afterEachHooks - stack of afterEach hooks defined
|
||||
* in parent contexts that should be run afterEach test in child contexts
|
||||
* @returns {Promise.<void>} Resolves once all tests and their hooks have run
|
||||
* @private
|
||||
*/
|
||||
async _runTestsInContext(
|
||||
testContext,
|
||||
beforeEachHooks = [],
|
||||
afterEachHooks = []
|
||||
) {
|
||||
const beforeHookRan = await this._runContextHooks(testContext, 'before');
|
||||
|
||||
if (beforeHookRan) {
|
||||
beforeEachHooks.push(testContext.beforeEachHooks || []);
|
||||
afterEachHooks.unshift(testContext.afterEachHooks || []);
|
||||
|
||||
await this._runTests(
|
||||
testContext,
|
||||
testContext.tests,
|
||||
flatten(beforeEachHooks),
|
||||
flatten(afterEachHooks)
|
||||
);
|
||||
|
||||
await Promise.each(
|
||||
Object.keys(testContext.childContextIds),
|
||||
childContextId => {
|
||||
const childContext = this.testContexts[childContextId];
|
||||
return this._runTestsInContext(
|
||||
childContext,
|
||||
beforeEachHooks,
|
||||
afterEachHooks
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
beforeEachHooks.pop();
|
||||
afterEachHooks.shift();
|
||||
|
||||
await this._runContextHooks(testContext, 'after');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronously run hooks in context's (before|after) hooks, starting from the first
|
||||
* hook
|
||||
* @param {TestContext} testContext - context containing hooks
|
||||
* @param {('before'|'after')} hookName - name of hooks to run callbacks for
|
||||
* @returns {Promise.<*>} Resolves when last hook in list has been executed
|
||||
* @private
|
||||
*/
|
||||
async _runContextHooks(testContext, hookName) {
|
||||
const hooks = testContext[`${hookName}Hooks`] || [];
|
||||
|
||||
return this._runHookChain(null, Date.now(), testContext, hookName, hooks);
|
||||
}
|
||||
|
||||
_runHookChain(test, testStart, testContext, hookName, hooks) {
|
||||
return Promise.each(hooks, async hook => {
|
||||
const error = await this._safelyRunFunction(
|
||||
hook.callback,
|
||||
hook.timeout,
|
||||
`${hookName} hook`
|
||||
);
|
||||
|
||||
if (error) {
|
||||
const errorPrefix = `Error occurred in "${
|
||||
testContext.name
|
||||
}" ${hookName} Hook: `;
|
||||
|
||||
if (test) {
|
||||
this._reportTestError(
|
||||
test,
|
||||
error,
|
||||
Date.now() - testStart,
|
||||
errorPrefix
|
||||
);
|
||||
} else {
|
||||
this._reportAllTestsAsFailed(
|
||||
testContext,
|
||||
error,
|
||||
testStart,
|
||||
errorPrefix
|
||||
);
|
||||
}
|
||||
|
||||
throw new Error();
|
||||
}
|
||||
})
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param testContext
|
||||
* @param error
|
||||
* @param testStart
|
||||
* @param errorPrefix
|
||||
* @private
|
||||
*/
|
||||
_reportAllTestsAsFailed(testContext, error, testStart, errorPrefix) {
|
||||
testContext.tests.forEach(test => {
|
||||
this._reportTestError(test, error, Date.now() - testStart, errorPrefix);
|
||||
});
|
||||
|
||||
testContext.childContextIds.forEach(contextId => {
|
||||
this._reportAllTestsAsFailed(
|
||||
this.testContext[contextId],
|
||||
error,
|
||||
testStart,
|
||||
errorPrefix
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronously run a list of tests
|
||||
* @param {TestContext} testContext - Test context to run beforeEach and AfterEach hooks
|
||||
* for
|
||||
* @param {Test[]} tests - List of tests to run
|
||||
* @param {Function[]} beforeEachHooks - list of functions to run before each test
|
||||
* @param {Function[]} afterEachHooks - list of functions to run after each test
|
||||
* @returns {Promise.<void>} - Resolves once all tests and their afterEach hooks have
|
||||
* been run
|
||||
* @private
|
||||
*/
|
||||
async _runTests(testContext, tests, beforeEachHooks, afterEachHooks) {
|
||||
return Promise.each(tests, async test => {
|
||||
this._updateStatus(EVENTS.TEST_STATUS, {
|
||||
testId: test.id,
|
||||
status: RunStatus.RUNNING,
|
||||
time: 0,
|
||||
message: '',
|
||||
});
|
||||
|
||||
const testStart = Date.now();
|
||||
|
||||
const beforeEachRan = await this._runHookChain(
|
||||
test,
|
||||
testStart,
|
||||
testContext,
|
||||
'beforeEach',
|
||||
beforeEachHooks
|
||||
);
|
||||
|
||||
if (beforeEachRan) {
|
||||
const error = await this._safelyRunFunction(
|
||||
test.func.bind(null, [test, this.testSuite.reduxStore.getState()]),
|
||||
test.timeout,
|
||||
'Test'
|
||||
);
|
||||
|
||||
// Update test status
|
||||
|
||||
if (error) {
|
||||
this._reportTestError(test, error, Date.now() - testStart);
|
||||
console.groupCollapsed(
|
||||
`%c ❌ Test Failed: ${test.description} (${this.testSuite.name})`,
|
||||
'color: #f44336;'
|
||||
);
|
||||
console.log(`Test Description: ${test.description}`);
|
||||
console.log(`Test Time Taken: ${Date.now() - testStart}`);
|
||||
console.log(`Suite Name: ${this.testSuite.name}`);
|
||||
console.log(`Suite Description: ${this.testSuite.description}`);
|
||||
console.log(error);
|
||||
console.groupEnd();
|
||||
} else {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
test.status = RunStatus.OK;
|
||||
|
||||
this._updateStatus(EVENTS.TEST_STATUS, {
|
||||
testId: test.id,
|
||||
status: RunStatus.OK,
|
||||
time: Date.now() - testStart,
|
||||
message: '',
|
||||
});
|
||||
|
||||
console.groupCollapsed(
|
||||
`%c ✅ Test Passed: ${test.description} (${this.testSuite.name})`,
|
||||
'color: #4CAF50;'
|
||||
);
|
||||
console.log(`Test Description: ${test.description}`);
|
||||
console.log(`Test Time Taken: ${Date.now() - testStart}`);
|
||||
console.log(`Suite Name: ${this.testSuite.name}`);
|
||||
console.log(`Suite Description: ${this.testSuite.description}`);
|
||||
console.groupEnd();
|
||||
}
|
||||
|
||||
// Update suite progress
|
||||
|
||||
this.completedTests += 1;
|
||||
|
||||
this._updateStatus(EVENTS.TEST_SUITE_STATUS, {
|
||||
suiteId: this.testSuite.id,
|
||||
status: RunStatus.RUNNING,
|
||||
progress: this.completedTests / this.tests.length * 100,
|
||||
time: Date.now() - this.runStartTime,
|
||||
message: '',
|
||||
});
|
||||
|
||||
await this._runHookChain(
|
||||
test,
|
||||
testStart,
|
||||
testContext,
|
||||
'afterEach',
|
||||
afterEachHooks
|
||||
);
|
||||
}
|
||||
}).catch(error => {
|
||||
this._updateStatus(EVENTS.TEST_SUITE_STATUS, {
|
||||
suiteId: this.testSuite.id,
|
||||
status: RunStatus.ERR,
|
||||
time: Date.now() - this.runStartTime,
|
||||
message: `Test suite failed: ${error.message}`,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param test
|
||||
* @param error
|
||||
* @param time
|
||||
* @param errorPrefix
|
||||
* @private
|
||||
*/
|
||||
_reportTestError(test, error, time, errorPrefix = '') {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
test.status = RunStatus.ERR;
|
||||
this._updateStatus(EVENTS.TEST_STATUS, {
|
||||
testId: test.id,
|
||||
status: RunStatus.ERR,
|
||||
time,
|
||||
message: `${errorPrefix}${
|
||||
error.message ? `${error.name}: ${error.message}` : error
|
||||
}`,
|
||||
stackTrace: cleanStack(error.stack),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param func
|
||||
* @param timeOutDuration
|
||||
* @param description
|
||||
* @return {Promise.<*>}
|
||||
* @private
|
||||
*/
|
||||
async _safelyRunFunction(func, timeOutDuration, description) {
|
||||
const syncResultOrPromise = captureThrownErrors(func);
|
||||
|
||||
if (syncResultOrPromise.error) {
|
||||
// Synchronous Error
|
||||
return syncResultOrPromise.error;
|
||||
}
|
||||
|
||||
// Asynchronous Error
|
||||
return capturePromiseErrors(
|
||||
syncResultOrPromise.result,
|
||||
timeOutDuration,
|
||||
description
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call a function and capture any errors that are immediately thrown.
|
||||
* @returns {Object} Object containing result of executing the function, or the error
|
||||
* message that was captured
|
||||
* @private
|
||||
*/
|
||||
|
||||
function captureThrownErrors(func) {
|
||||
const result = {};
|
||||
|
||||
try {
|
||||
result.result = func();
|
||||
} catch (error) {
|
||||
result.error = error;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps a promise so that if it's rejected or an error is thrown while it's being
|
||||
* evaluated, it's captured and thrown no further
|
||||
* @param {*} target - Target to wrap. If a thenable object, it's wrapped so if it's
|
||||
* rejected or an error is thrown, it will be captured. If a non-thenable object,
|
||||
* wrapped in resolved promise and returned.
|
||||
* @param {Number} timeoutDuration - Number of milliseconds the promise is allowed
|
||||
* to pend before it's considered timed out
|
||||
* @param {String} description - Description of the context the promises is defined
|
||||
* in, used for reporting where a timeout occurred in the resulting error message.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function capturePromiseErrors(target, timeoutDuration, description) {
|
||||
let returnValue = null;
|
||||
|
||||
try {
|
||||
returnValue = Promise.resolve(target)
|
||||
.then(() => null, error => Promise.resolve(error))
|
||||
.catch(error => Promise.resolve(error))
|
||||
.timeout(
|
||||
timeoutDuration,
|
||||
`${description} took longer than ${timeoutDuration}ms. This can be extended with the timeout option.`
|
||||
);
|
||||
} catch (error) {
|
||||
returnValue = Promise.resolve(error);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flatten a two dimensional array to a single dimensional array
|
||||
* @param {*[]} list - two dimensional array
|
||||
* @returns {*[]} One-dimensional array
|
||||
*/
|
||||
function flatten(list) {
|
||||
return list.reduce((memo, contextHooks) => memo.concat(contextHooks), []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a runtime error to the console
|
||||
* @param {String} error - Message to log to the console
|
||||
*/
|
||||
function testRuntimeError(error) {
|
||||
console.error(`ReactNativeFirebaseTests.TestRuntimeError: ${error}`);
|
||||
}
|
||||
|
||||
export default TestRun;
|
|
@ -1,157 +0,0 @@
|
|||
import 'should';
|
||||
import 'should-sinon';
|
||||
|
||||
import TestSuiteDefinition from './TestSuiteDefinition';
|
||||
import TestRun from './TestRun';
|
||||
|
||||
/**
|
||||
* Incrementing counter to assign each test suite a globally unique id. Should be
|
||||
* accessed only through assignTestSuiteId
|
||||
* @type {number} Counter that maintains globally unique id and increments each time
|
||||
* a new id is assigned
|
||||
*/
|
||||
let testSuiteCounter = 0;
|
||||
|
||||
/**
|
||||
* Increment the testSuiteCounter and return the new value. Used
|
||||
* for assigning a new globally unique id to a test suite.
|
||||
* @returns {number} globally unique id assigned to each test suite
|
||||
*/
|
||||
function assignTestSuiteId() {
|
||||
testSuiteCounter += 1;
|
||||
return testSuiteCounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class that provides imperative interface for constructing and running a test suite.
|
||||
* Used for instantiating a new test suite, adding tests to it and then running all or
|
||||
* a subset of those tests.
|
||||
*
|
||||
* @example
|
||||
* // Creates a new test suite
|
||||
* const testSuit = new TestSuite('Feature Group A', 'Feature a, b and c');
|
||||
*/
|
||||
class TestSuite {
|
||||
/**
|
||||
* Creates a new test suite.
|
||||
* @param {String} name - The name of the test suite
|
||||
* @param {String} description - A short description of the test suite
|
||||
* @param {Object} firebase - Object containing native and web firebase instances
|
||||
* @param {Object} firebase.native - Native firebase instance
|
||||
* @para {Object} firebase.web - Web firebase instance
|
||||
*/
|
||||
constructor(name, description, firebase) {
|
||||
this.id = assignTestSuiteId();
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
|
||||
this.reduxStore = null;
|
||||
this.testDefinitions = new TestSuiteDefinition(this, firebase);
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Function} TestDefinitionFunction
|
||||
* @param {TestDSL} testDSL - class instance that defines the testing DSL that can
|
||||
* be used in defining tests
|
||||
*/
|
||||
|
||||
/**
|
||||
* Adds tests defined in a function to the test suite
|
||||
* @param {TestDefinitionFunction} testDefinition - A function that defines one or
|
||||
* more test suites using the test DSL.
|
||||
* @example
|
||||
* // Adding tests
|
||||
* const testDefinition = function({ describe, it }) {
|
||||
* describe('Some context', () => {
|
||||
* it('then does something', () => {
|
||||
* // Test assertions here
|
||||
* })
|
||||
* })
|
||||
* testSuite.addTests(testDefinition);
|
||||
*/
|
||||
addTests(testDefinition) {
|
||||
testDefinition(this.testDefinitions.DSL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} ReduxStore
|
||||
* @property {Function} getState - Returns the current state of the store
|
||||
* @property {Function} dispatch - Dispatches a new action to update to store
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets the redux store assigned to the test suite
|
||||
* @param {ReduxStore} store - The redux store to add to the test suite
|
||||
* @param {Function} testSuiteAction - Function that accepts an object of
|
||||
* event values and returns another that is suitable to dispatch to the
|
||||
* redux store. Responsible for handling events when the test suite's status
|
||||
* has changed.
|
||||
* @param {Function} testAction - Function that accepts an object of
|
||||
* event values and returns another that is suitable to dispatch to the
|
||||
* redux store. Responsible for handling events when a test's status
|
||||
* has changed.
|
||||
*/
|
||||
setStore(store, testSuiteAction, testAction) {
|
||||
this.reduxStore = store;
|
||||
this.suiteChangHandler = testSuiteAction;
|
||||
this.testChangHandler = testAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run all the tests matching an array of ids. If the array is not provided, run all
|
||||
* test in the test suite.
|
||||
* @param {number[]=} testIds - array of ids for tests to run
|
||||
* @throws {RangeError} testIds must correspond with tests in the test suite
|
||||
* @example
|
||||
* // Running all tests in the test suite
|
||||
* testSuite.run();
|
||||
* @example
|
||||
* // Run only tests with id 1 and 2
|
||||
* testSuite.run([1, 2]);
|
||||
*/
|
||||
async run(testIds = undefined) {
|
||||
const testsToRun = (() =>
|
||||
(testIds || Object.keys(this.testDefinitions.tests)).reduce(
|
||||
(memo, id) => {
|
||||
const test = this.testDefinitions.tests[id];
|
||||
|
||||
if (!test) {
|
||||
throw new RangeError(
|
||||
`ReactNativeFirebaseTests.TestRunError: Test with id ${id} not found in test suite ${
|
||||
this.name
|
||||
}`
|
||||
);
|
||||
}
|
||||
|
||||
if (!this.testDefinitions.pendingTestIds[id]) {
|
||||
memo.push(test);
|
||||
}
|
||||
|
||||
return memo;
|
||||
},
|
||||
[]
|
||||
))();
|
||||
|
||||
const testRun = new TestRun(
|
||||
this,
|
||||
testsToRun.reverse(),
|
||||
this.testDefinitions
|
||||
);
|
||||
|
||||
testRun.onChange('TEST_SUITE_STATUS', values => {
|
||||
if (this.suiteChangHandler) {
|
||||
this.suiteChangHandler(values);
|
||||
}
|
||||
});
|
||||
|
||||
testRun.onChange('TEST_STATUS', values => {
|
||||
if (this.testChangHandler) {
|
||||
this.testChangHandler(values);
|
||||
}
|
||||
});
|
||||
|
||||
await testRun.execute();
|
||||
}
|
||||
}
|
||||
|
||||
export default TestSuite;
|
|
@ -1,388 +0,0 @@
|
|||
import TestDSL from './TestDSL';
|
||||
|
||||
/**
|
||||
* Incrementing counter to assign each test context a globally unique id.
|
||||
* @type {number} Counter that maintains globally unique id and increments each time
|
||||
* a new id is assigned
|
||||
*/
|
||||
let testContextCounter = 0;
|
||||
|
||||
/**
|
||||
* Incrementing counter to assign each test a globally unique id.
|
||||
* @type {number} Counter that maintains globally unique id and increments each time
|
||||
* a new id is assigned
|
||||
*/
|
||||
let testCounter = 0;
|
||||
|
||||
/**
|
||||
* Increment the testCounter and return the new value. Used
|
||||
* for assigning a new globally unique id to a test.
|
||||
* @returns {number} globally unique id assigned to each test
|
||||
*/
|
||||
function assignTestId() {
|
||||
testCounter += 1;
|
||||
return testCounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the testContextCounter and return the new value. Used
|
||||
* for assigning a new globally unique id to a test context.
|
||||
* @returns {number} globally unique id assigned to each test context
|
||||
*/
|
||||
function assignContextId() {
|
||||
testContextCounter += 1;
|
||||
return testContextCounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum for operators that can be used when combining test properties with their
|
||||
* parents at definition time.
|
||||
* @readonly
|
||||
* @enum {String} ContextOperator
|
||||
*/
|
||||
const CONTEXT_OPERATORS = {
|
||||
/** Perform OR of test value with context chain values * */
|
||||
OR: 'OR',
|
||||
};
|
||||
|
||||
/**
|
||||
* Class that provides imperative interface for defining tests. When defining tests
|
||||
* the declarative interface for this class, {@link TestDSL} should be use instead.
|
||||
*/
|
||||
class TestSuiteDefinition {
|
||||
/**
|
||||
* Creates a new TestSuiteDefinition
|
||||
* @param {TestSuite} testSuite - The {@link TestSuite} instance for which to
|
||||
* define tests for.
|
||||
* @param {Object} firebase - Object containing native and web firebase instances
|
||||
* @param {Object} firebase.native - Native firebase instance
|
||||
* @para {Object} firebase.web - Web firebase instance
|
||||
*/
|
||||
constructor(testSuite, firebase) {
|
||||
this.testSuite = testSuite;
|
||||
|
||||
this.tests = {};
|
||||
this.pendingTestIds = {};
|
||||
this.focusedTestIds = {};
|
||||
|
||||
this.testContexts = {};
|
||||
|
||||
this.rootTestContextId = assignContextId();
|
||||
this.rootTestContext = this._initialiseContext(this.rootTestContextId, {
|
||||
name: '',
|
||||
focus: false,
|
||||
pending: false,
|
||||
parentContextId: null,
|
||||
});
|
||||
|
||||
this.currentTestContext = this.rootTestContext;
|
||||
|
||||
this._testDSL = new TestDSL(this, firebase);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the instance of {@link TestDSL} used for declaratively defining tests
|
||||
* @returns {TestDSL} The TestDSL used for defining tests
|
||||
*/
|
||||
get DSL() {
|
||||
return this._testDSL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a function as a before hook to the current test context
|
||||
* @param {Function} callback - Function to add as before hook to current test context
|
||||
*/
|
||||
addBeforeHook(callback, options = {}) {
|
||||
this._addHook('before', callback, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a function as a before each hook to the current test context
|
||||
* @param {Function} callback - Function to add as before each hook to current test
|
||||
* context
|
||||
*/
|
||||
addBeforeEachHook(callback, options = {}) {
|
||||
this._addHook('beforeEach', callback, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a function as a after each hook to the current test context
|
||||
* @param {Function} callback - Function to add as after each hook to current test context
|
||||
*/
|
||||
addAfterEachHook(callback, options = {}) {
|
||||
this._addHook('afterEach', callback, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a function as a after hook to the current test context
|
||||
* @param {Function} callback - Function to add as after hook to current test context
|
||||
*/
|
||||
addAfterHook(callback, options = {}) {
|
||||
this._addHook('after', callback, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a function to the list of hooks matching hookName, for the current test context
|
||||
* @param {('before'|'beforeEach'|'afterEach'|'after')} hookName - The name of the hook to add the function to
|
||||
* @param {Function} callback - Function to add as a hook
|
||||
* @param {Object=} options - Hook configuration options
|
||||
* @private
|
||||
*/
|
||||
_addHook(hookName, callback, options = {}) {
|
||||
const hookAttribute = `${hookName}Hooks`;
|
||||
|
||||
if (callback && typeof callback === 'function') {
|
||||
this.currentTestContext[hookAttribute] =
|
||||
this.currentTestContext[hookAttribute] || [];
|
||||
this.currentTestContext[hookAttribute].push({
|
||||
callback,
|
||||
timeout: options.timeout || 15000,
|
||||
});
|
||||
} else {
|
||||
testDefinitionError(
|
||||
`non-function value ${callback} passed to ${hookName} for '${
|
||||
this.currentTestContext.name
|
||||
}'`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} ContextOptions
|
||||
* @property {Boolean} [focused=undefined] - whether context is focused or not.
|
||||
* @property {Boolean} [pending=undefined] - whether context is pending or not.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} TestOptions
|
||||
* @extends ContextOptions
|
||||
* @property {Number} [timeout=5000] - Number of milliseconds before test times out
|
||||
*/
|
||||
|
||||
/**
|
||||
* Push a test context onto the context stack, making it the new current test context
|
||||
* @param {String} name - The name of the new context
|
||||
* @param {ContextOptions} options - Options for new context
|
||||
*/
|
||||
pushTestContext(name, options = {}) {
|
||||
const testContextId = assignContextId();
|
||||
const parentContext = this.currentTestContext;
|
||||
this.currentTestContext = this._initialiseContext(
|
||||
testContextId,
|
||||
Object.assign({ name, parentContextId: parentContext.id }, options)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pop test context off the context stack, making the previous context the new
|
||||
* current context.
|
||||
*/
|
||||
popTestContext() {
|
||||
const { parentContextId } = this.currentTestContext;
|
||||
this.currentTestContext = this.testContexts[parentContextId];
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a test to the current test context
|
||||
* @param {String} description - The new test's description
|
||||
* @param {ContextOptions} options - The options for the new test
|
||||
* @param {Function} testFunction - The function that comprises the test's body
|
||||
*/
|
||||
addTest(description, options, testFunction = undefined) {
|
||||
let _testFunction;
|
||||
let _options;
|
||||
|
||||
if (testFunction) {
|
||||
_testFunction = testFunction;
|
||||
_options = options;
|
||||
} else {
|
||||
_testFunction = options;
|
||||
_options = {};
|
||||
}
|
||||
|
||||
if (_testFunction && typeof _testFunction === 'function') {
|
||||
// Create test
|
||||
const testId = assignTestId();
|
||||
|
||||
this._createTest(testId, {
|
||||
testContextId: this.currentTestContext.id,
|
||||
testSuiteId: this.testSuite.id,
|
||||
description:
|
||||
this._testDescriptionContextPrefix(this.currentTestContext) +
|
||||
description,
|
||||
func: _testFunction,
|
||||
timeout: _options.timeout || 5000,
|
||||
});
|
||||
|
||||
// Add tests to context
|
||||
this.currentTestContext.testIds.push(testId);
|
||||
|
||||
if (_options.focus || this.currentTestContext.focus) {
|
||||
this.focusedTestIds[testId] = true;
|
||||
}
|
||||
|
||||
if (_options.pending || this.currentTestContext.pending) {
|
||||
this.pendingTestIds[testId] = true;
|
||||
}
|
||||
} else {
|
||||
testDefinitionError(`Invalid test function for "${description}".`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the prefix to prepend to a test to fully describe it. Any context that is
|
||||
* nested 2 or more deep, i.e. non the root context nor a child of the root context,
|
||||
* has its name recursively prepended to all tests in that context or contexts it
|
||||
* contains. This allows tests to be easily displayed in a LinkedList during viewing
|
||||
* and reporting the test suite.
|
||||
* @param {Object} contextProperties - Properties of current context
|
||||
* @param {Number} contextProperties.id - Id of context
|
||||
* @param {String} contextProperties.name - Name of context
|
||||
* @param {Number} contextProperties.parentContextId - Id of context's parent
|
||||
* @param {String} [suffix=''] - Accumulation of context prefixes so far. Starts empty
|
||||
* and collects context prefixes as it recursively calls itself to iterate up the
|
||||
* context tree.
|
||||
* @returns {String} Prefix to be prepended to current accumulative string of context
|
||||
* names
|
||||
* @private
|
||||
*/
|
||||
_testDescriptionContextPrefix({ id, name, parentContextId }, suffix = '') {
|
||||
if (
|
||||
id === this.rootTestContextId ||
|
||||
parentContextId === this.rootTestContextId
|
||||
) {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
return this._testDescriptionContextPrefix(
|
||||
this.testContexts[parentContextId],
|
||||
`${name} ${suffix}`
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} TestContext
|
||||
* @property {Number} id - Globally unique id
|
||||
* @property {String} name - Short description of context
|
||||
* @property {Boolean} [focus=false] - Whether context is focused
|
||||
* @property {Boolean} [pending=false] - Whether context is pending
|
||||
* @property {Number} [parentContextId=undefined] - Id of context that contains the current one
|
||||
* @property {Number[]} testIds - List of ids of tests to be run in current context
|
||||
* @property {Number} testSuiteId - Id of test suite test context is apart of
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a context from options provided
|
||||
* @param {Number} testContextId - Id to assign to new context once it's created
|
||||
* @param {Object} options - options to use to create the context
|
||||
* @param {String} options.name - Name of context to create
|
||||
* @param {Boolean} options.focus - Whether context is focused or not
|
||||
* @param {Boolean} options.pending - Whether context is pending or not
|
||||
* @param {Number} [options.parentContextId=undefined] - Id of context's parent
|
||||
* @returns {TestContext} New test context once it has been initialised
|
||||
* @private
|
||||
*/
|
||||
_initialiseContext(testContextId, { name, focus, pending, parentContextId }) {
|
||||
const existingContext = this.testContexts[testContextId];
|
||||
|
||||
if (existingContext) {
|
||||
return existingContext;
|
||||
}
|
||||
|
||||
const parentContext = this.testContexts[parentContextId];
|
||||
|
||||
const newTestContext = {
|
||||
id: testContextId,
|
||||
name,
|
||||
focus: this._incorporateParentValue(
|
||||
parentContext,
|
||||
'focus',
|
||||
focus,
|
||||
CONTEXT_OPERATORS.OR
|
||||
),
|
||||
pending: this._incorporateParentValue(
|
||||
parentContext,
|
||||
'pending',
|
||||
pending,
|
||||
CONTEXT_OPERATORS.OR
|
||||
),
|
||||
parentContextId,
|
||||
testIds: [],
|
||||
testSuiteId: this.testSuite.id,
|
||||
};
|
||||
|
||||
this.testContexts[testContextId] = newTestContext;
|
||||
|
||||
return newTestContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively use an operator to consolidate a test's value with that of its test
|
||||
* context chain.
|
||||
* @param {TestContext} parentContext - Parent context to examine for its value
|
||||
* @param {String} attributeName - name of the attribute to use from parent
|
||||
* @param {*} value - Value of current context or test to use as one operand with
|
||||
* the parent context's value
|
||||
* @param {('OR')} operator - Operator to use to consolidate current value and
|
||||
* parent context's value
|
||||
* @returns {*} Consolidated value, encorporating context parents' values
|
||||
* @private
|
||||
*/
|
||||
_incorporateParentValue(parentContext, attributeName, value, operator) {
|
||||
if (!parentContext) {
|
||||
return value;
|
||||
}
|
||||
|
||||
switch (operator) {
|
||||
case CONTEXT_OPERATORS.OR:
|
||||
return parentContext[attributeName] || value;
|
||||
default:
|
||||
throw new Error(`Unknown context operator ${operator}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new test from the options provided and add it to the suite
|
||||
* @param {Number} testId - Unique id to give to the test
|
||||
* @param {Object} testAttributes - attributes to create the test with
|
||||
* @param {Number} testAttributes.testContextId - Id of context test belongs to
|
||||
* @param {String} testAttributes.description - Short description of the test
|
||||
* @param {Function} testAttributes.func - Function that comprises the body of the test
|
||||
* @param {Number} testAttributes.testSuiteId - Id of test suite test belongs to
|
||||
* @param {Number} testAttributes.timeout - Number of milliseconds before test times out
|
||||
* @returns {Test} New test matching provided options
|
||||
* @private
|
||||
*/
|
||||
_createTest(
|
||||
testId,
|
||||
{ testContextId, description, func, testSuiteId, timeout }
|
||||
) {
|
||||
const newTest = {
|
||||
id: testId,
|
||||
testContextId,
|
||||
description,
|
||||
func,
|
||||
testSuiteId,
|
||||
status: null,
|
||||
message: null,
|
||||
time: 0,
|
||||
timeout,
|
||||
};
|
||||
|
||||
this.tests[testId] = newTest;
|
||||
|
||||
return newTest;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log test definition error to the console with a message indicating the test
|
||||
* definition was skipped.
|
||||
* @param {String} error - Error message to include in message logged to the console
|
||||
*/
|
||||
function testDefinitionError(error) {
|
||||
console.error(`ReactNativeFirebaseTests.TestDefinitionError: ${error}`);
|
||||
console.error('This test was ignored.');
|
||||
}
|
||||
|
||||
export default TestSuiteDefinition;
|
|
@ -1,73 +0,0 @@
|
|||
{
|
||||
"name": "react-native-firebase-tests",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node node_modules/react-native/local-cli/cli.js start --platforms ios,android",
|
||||
"android:dev": "react-native run-android",
|
||||
"android:prod": "react-native run-android --configuration=release",
|
||||
"ios:dev": "react-native run-ios",
|
||||
"ios:prod": "react-native run-ios --configuration=release",
|
||||
"ios:pod:install": "cd ios && rm -rf ReactNativeFirebaseDemo.xcworkspace && pod install && cd ..",
|
||||
"test": "echo 'Tests should be run from within the RN application.\n\rSee https://rnfirebase.io/docs/master/testing for more info.'",
|
||||
"build-lib-for-tests": "babel --presets=es2015-mod,es3,react-native ./lib/ -d ./__tests__/build/lib/ --source-maps",
|
||||
"internal-tests": "npm run build-lib-for-tests && babel --presets=es2015-mod,es3 ./__tests__/src/ -d ./__tests__/build/ --source-maps && node ./__tests__/build/index.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/invertase/react-native-firebase.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/invertase/react-native-firebase/issues"
|
||||
},
|
||||
"homepage": "https://github.com/invertase/react-native-firebase/tests/#readme",
|
||||
"dependencies": {
|
||||
"babel-preset-es2015-mod": "^6.6.0",
|
||||
"babel-preset-es3": "^1.0.1",
|
||||
"bluebird": "^3.5.0",
|
||||
"bows": "^1.6.0",
|
||||
"cuid": "^1.3.8",
|
||||
"deeps": "^1.4.4",
|
||||
"firebase": "^4.10.1",
|
||||
"js-beautify": "^1.7.5",
|
||||
"lodash.groupby": "^4.6.0",
|
||||
"lodash.some": "^4.6.0",
|
||||
"prop-types": "^15.6.1",
|
||||
"query-string": "^5.1.0",
|
||||
"react": "^16.3.0-alpha.1",
|
||||
"react-native": "^0.54.4",
|
||||
"react-native-vector-icons": "^4.5.0",
|
||||
"react-navigation": "^1.2.1",
|
||||
"react-redux": "^5.0.7",
|
||||
"react-test-renderer": "16.2.0",
|
||||
"redux": "^3.6.0",
|
||||
"redux-logger": "^2.8.2",
|
||||
"redux-persist": "^4.10.2",
|
||||
"redux-thunk": "^2.2.0",
|
||||
"should": "^11.2.0",
|
||||
"should-sinon": "^0.0.5",
|
||||
"sinon": "^3.2.1",
|
||||
"url-parse": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.24.0",
|
||||
"babel-eslint": "^7.1.1",
|
||||
"babel-jest": "19.0.0",
|
||||
"babel-plugin-flow-react-proptypes": "^0.21.0",
|
||||
"babel-plugin-istanbul": "^4.1.5",
|
||||
"babel-preset-react-native": "1.9.1",
|
||||
"colors": "^1.1.2",
|
||||
"eslint": "^3.16.1",
|
||||
"eslint-config-airbnb": "^14.1.0",
|
||||
"eslint-plugin-flowtype": "^2.46.1",
|
||||
"eslint-plugin-import": "^2.9.0",
|
||||
"eslint-plugin-jsx-a11y": "^4.0.0",
|
||||
"eslint-plugin-react": "^6.10.0",
|
||||
"flow-bin": "^0.65.0",
|
||||
"jest": "19.0.2",
|
||||
"redux-immutable-state-invariant": "^1.2.4"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "react-native"
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
const blacklist = require('metro/src/blacklist');
|
||||
|
||||
module.exports = {
|
||||
getBlacklistRE() {
|
||||
return blacklist([/react-native\/local-cli\/core\/__fixtures__.*/]);
|
||||
},
|
||||
};
|
|
@ -1,18 +0,0 @@
|
|||
export const APP_SET_NETWORK_STATE: string = 'APP_SET_NETWORK_STATE';
|
||||
export const APP_SET_APP_STATE: string = 'APP_SET_APP_STATE';
|
||||
|
||||
export function setNetworkState(isConnected: boolean): Object {
|
||||
return {
|
||||
type: APP_SET_NETWORK_STATE,
|
||||
isConnected,
|
||||
};
|
||||
}
|
||||
|
||||
export function setAppState(
|
||||
appState: 'active' | 'background' | 'inactive'
|
||||
): Object {
|
||||
return {
|
||||
type: APP_SET_APP_STATE,
|
||||
appState,
|
||||
};
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
export const FCM_SET_TOKEN: string = 'FCM_SET_TOKEN';
|
||||
|
||||
export function setToken(token: string): Object {
|
||||
return {
|
||||
type: FCM_SET_TOKEN,
|
||||
token,
|
||||
};
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
export const TEST_SET_SUITE_STATUS: string = 'TEST_SET_SUITE_STATUS';
|
||||
export const TEST_SET_STATUS: string = 'TEST_SET_STATUS';
|
||||
|
||||
export function setSuiteStatus({ suiteId, status, time, message, progress }) {
|
||||
return {
|
||||
type: TEST_SET_SUITE_STATUS,
|
||||
suiteId,
|
||||
|
||||
status,
|
||||
message,
|
||||
|
||||
time,
|
||||
progress,
|
||||
};
|
||||
}
|
||||
|
||||
export function setTestStatus({
|
||||
testId,
|
||||
status,
|
||||
stackTrace,
|
||||
time = 0,
|
||||
message = null,
|
||||
}) {
|
||||
return {
|
||||
type: TEST_SET_STATUS,
|
||||
testId,
|
||||
|
||||
status,
|
||||
message,
|
||||
stackTrace,
|
||||
time,
|
||||
};
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
import RNfirebase from './../firebase';
|
||||
|
||||
export default async message => {
|
||||
console.log('Message', message);
|
||||
|
||||
const notification = new RNfirebase.notifications.Notification();
|
||||
notification
|
||||
.setTitle('Background notification')
|
||||
.setBody('Background body')
|
||||
.setNotificationId('background')
|
||||
.android.setChannelId('test')
|
||||
.android.setClickAction('action')
|
||||
.android.setPriority(RNfirebase.notifications.Android.Priority.Max);
|
||||
|
||||
await RNfirebase.notifications().displayNotification(notification);
|
||||
return Promise.resolve();
|
||||
};
|
|
@ -1,45 +0,0 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { StyleSheet, View, Text } from 'react-native';
|
||||
|
||||
function Banner({ type, children, style, textStyle }) {
|
||||
return (
|
||||
<View style={[styles.banner, styles[type || 'default'], style]}>
|
||||
<Text numberOfLines={1} style={[styles.bannerText, textStyle]}>
|
||||
{children}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
Banner.propTypes = {
|
||||
/* eslint-disable react/require-default-props */
|
||||
/* eslint-disable react/no-typos */
|
||||
type: PropTypes.oneOf(['success', 'warning', 'error', 'info']),
|
||||
children: PropTypes.oneOfType([PropTypes.string, PropTypes.array]).isRequired,
|
||||
style: View.propTypes.style,
|
||||
textStyle: Text.propTypes.style,
|
||||
/* eslint-enable react/require-default-props */
|
||||
/* eslint-enable react/no-typos */
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
banner: {
|
||||
alignItems: 'center',
|
||||
elevation: 3,
|
||||
},
|
||||
bannerText: {
|
||||
color: '#ffffff',
|
||||
},
|
||||
warning: {
|
||||
backgroundColor: '#f57c00',
|
||||
},
|
||||
error: {
|
||||
backgroundColor: '#f44336',
|
||||
},
|
||||
success: {
|
||||
backgroundColor: '#4CAF50',
|
||||
},
|
||||
});
|
||||
|
||||
export default Banner;
|
|
@ -1,84 +0,0 @@
|
|||
import React from 'react';
|
||||
import { View, TouchableHighlight } from 'react-native';
|
||||
import VectorIcon from 'react-native-vector-icons/MaterialIcons';
|
||||
|
||||
type Props = {
|
||||
name: string,
|
||||
/* eslint-disable react/require-default-props */
|
||||
size?: number,
|
||||
color?: string,
|
||||
allowFontScaling?: boolean,
|
||||
style?: Object,
|
||||
rotate?: number,
|
||||
onPress?: () => void,
|
||||
underlayColor?: string,
|
||||
/* eslint-enable react/require-default-props */
|
||||
};
|
||||
|
||||
// TODO Spin?
|
||||
class Icon extends React.Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.measured = false;
|
||||
this.state = {
|
||||
width: 0,
|
||||
};
|
||||
}
|
||||
|
||||
setDimensions(e) {
|
||||
if (!this.measured) {
|
||||
this.measured = true;
|
||||
this.setState({
|
||||
width: e.nativeEvent.layout.width,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
props: Props;
|
||||
|
||||
render() {
|
||||
const {
|
||||
name,
|
||||
size = 24,
|
||||
color = '#757575',
|
||||
allowFontScaling = true,
|
||||
style,
|
||||
rotate,
|
||||
onPress,
|
||||
underlayColor,
|
||||
} = this.props;
|
||||
|
||||
const icon = (
|
||||
<View
|
||||
onLayout={e => this.setDimensions(e)}
|
||||
style={[
|
||||
style,
|
||||
rotate ? { transform: [{ rotate: `${rotate}deg` }] } : null,
|
||||
]}
|
||||
>
|
||||
<VectorIcon
|
||||
name={name.toLowerCase().replace(/\s+/g, '-')}
|
||||
size={size}
|
||||
color={color}
|
||||
allowFontScaling={allowFontScaling}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
|
||||
if (!onPress) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
return (
|
||||
<TouchableHighlight
|
||||
underlayColor={underlayColor || 'rgba(0, 0, 0, 0.054)'}
|
||||
onPress={onPress}
|
||||
style={{ padding: 8, borderRadius: (this.state.width + 8) / 2 }}
|
||||
>
|
||||
{icon}
|
||||
</TouchableHighlight>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Icon;
|