mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-01-12 22:50:20 +08:00
@@ -38,6 +38,7 @@ module.exports = {
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/camelcase': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/ban-ts-ignore': 'warn',
|
||||
},
|
||||
globals: {
|
||||
__DEV__: true,
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
module.exports = {
|
||||
maxConcurrency: 10,
|
||||
preset: './tests/node_modules/react-native/jest-preset.js',
|
||||
setupFiles: ['./jest.setup.js'],
|
||||
testMatch: ['**/packages/**/__tests__/**/*.test.js'],
|
||||
transform: {
|
||||
'^.+\\.(js)$': '<rootDir>/node_modules/babel-jest',
|
||||
'\\.(ts|tsx)$': 'ts-jest',
|
||||
},
|
||||
setupFiles: ['./jest.setup.ts'],
|
||||
testMatch: ['**/packages/**/__tests__/**/*.test.(ts|js)'],
|
||||
modulePaths: ['node_modules', './tests/node_modules'],
|
||||
testPathIgnorePatterns: ['./packages/template'],
|
||||
moduleDirectories: ['node_modules', './tests/node_modules'],
|
||||
moduleFileExtensions: ['ts', 'tsx', 'js'],
|
||||
};
|
||||
|
||||
10
package.json
10
package.json
@@ -34,6 +34,9 @@
|
||||
"format:markdown": "prettier --write \"docs/**/*.md\""
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "7.9.5",
|
||||
"@babel/preset-flow": "7.9.0",
|
||||
"@types/jest": "^25.2.1",
|
||||
"@types/react-native": "^0.62.0",
|
||||
"@typescript-eslint/eslint-plugin": "^2.18.0",
|
||||
"@typescript-eslint/parser": "^2.18.0",
|
||||
@@ -45,15 +48,14 @@
|
||||
"eslint-plugin-react": "^7.19.0",
|
||||
"genversion": "^2.2.0",
|
||||
"inquirer": "^7.1.0",
|
||||
"jest": "^25.5.1",
|
||||
"lerna": "3.20.2",
|
||||
"prettier": "^1.19.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"shelljs": "^0.8.3",
|
||||
"ts-jest": "^25.4.0",
|
||||
"typedoc": "^0.15.0",
|
||||
"typescript": "^3.8.3",
|
||||
"jest": "^24.9.0",
|
||||
"@babel/preset-env": "7.9.5",
|
||||
"@babel/preset-flow": "7.9.0"
|
||||
"typescript": "^3.8.3"
|
||||
},
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
|
||||
@@ -12,8 +12,13 @@ describe('Cloud Functions', () => {
|
||||
describe('useFunctionsEmulator()', () => {
|
||||
it('useFunctionsEmulator -> uses 10.0.2.2', () => {
|
||||
functions().useFunctionsEmulator('http://localhost');
|
||||
|
||||
// @ts-ignore
|
||||
expect(functions()._useFunctionsEmulatorOrigin).toBe('http://10.0.2.2');
|
||||
|
||||
functions().useFunctionsEmulator('http://127.0.0.1');
|
||||
|
||||
// @ts-ignore
|
||||
expect(functions()._useFunctionsEmulatorOrigin).toBe('http://10.0.2.2');
|
||||
});
|
||||
});
|
||||
@@ -22,6 +27,8 @@ describe('Cloud Functions', () => {
|
||||
it('throws an error with an incorrect timeout', () => {
|
||||
try {
|
||||
const app = firebase.app();
|
||||
|
||||
// @ts-ignore
|
||||
app.functions().httpsCallable('example', { timeout: 'test' });
|
||||
return Promise.reject(new Error('Did not throw'));
|
||||
} catch (e) {
|
||||
@@ -11,7 +11,10 @@ describe('Performance Monitoring', () => {
|
||||
|
||||
describe('setPerformanceCollectionEnabled', () => {
|
||||
it('errors if not boolean', () => {
|
||||
expect(() => perf().setPerformanceCollectionEnabled()).toThrow('must be a boolean');
|
||||
expect(() => {
|
||||
// @ts-ignore
|
||||
perf().setPerformanceCollectionEnabled();
|
||||
}).toThrow('must be a boolean');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,11 +22,14 @@ describe('Performance Monitoring', () => {
|
||||
it('returns an instance of Trace', () => {
|
||||
const trace = perf().newTrace('invertase');
|
||||
expect(trace.constructor.name).toEqual('Trace');
|
||||
|
||||
// @ts-ignore
|
||||
expect(trace._identifier).toEqual('invertase');
|
||||
});
|
||||
|
||||
it('errors if identifier not a string', () => {
|
||||
try {
|
||||
// @ts-ignore
|
||||
perf().newTrace(1337);
|
||||
return Promise.reject(new Error('Did not throw'));
|
||||
} catch (e) {
|
||||
@@ -51,12 +57,17 @@ describe('Performance Monitoring', () => {
|
||||
it('returns an instance of HttpMetric', async () => {
|
||||
const metric = perf().newHttpMetric('https://invertase.io', 'GET');
|
||||
expect(metric.constructor.name).toEqual('HttpMetric');
|
||||
|
||||
// @ts-ignore
|
||||
expect(metric._url).toEqual('https://invertase.io');
|
||||
|
||||
// @ts-ignore
|
||||
expect(metric._httpMethod).toEqual('GET');
|
||||
});
|
||||
|
||||
it('errors if url not a string', async () => {
|
||||
try {
|
||||
// @ts-ignore
|
||||
perf().newHttpMetric(1337, 7331);
|
||||
return Promise.reject(new Error('Did not throw'));
|
||||
} catch (e) {
|
||||
@@ -67,6 +78,7 @@ describe('Performance Monitoring', () => {
|
||||
|
||||
it('errors if httpMethod not a string', async () => {
|
||||
try {
|
||||
// @ts-ignore
|
||||
perf().newHttpMetric('https://invertase.io', 1337);
|
||||
return Promise.reject(new Error('Did not throw'));
|
||||
} catch (e) {
|
||||
@@ -79,6 +91,7 @@ describe('Performance Monitoring', () => {
|
||||
|
||||
it('errors if httpMethod not a valid type', async () => {
|
||||
try {
|
||||
// @ts-ignore
|
||||
perf().newHttpMetric('https://invertase.io', 'FIRE');
|
||||
return Promise.reject(new Error('Did not throw'));
|
||||
} catch (e) {
|
||||
@@ -93,6 +106,7 @@ describe('Performance Monitoring', () => {
|
||||
describe('setPerformanceCollectionEnabled()', () => {
|
||||
it('errors if not boolean', async () => {
|
||||
try {
|
||||
// @ts-ignore
|
||||
firebase.perf().setPerformanceCollectionEnabled();
|
||||
return Promise.reject(new Error('Did not throw'));
|
||||
} catch (e) {
|
||||
Reference in New Issue
Block a user