Add remote config tests
This commit is contained in:
parent
b9b8e9062e
commit
3cf04908c3
|
@ -1,5 +1,29 @@
|
||||||
|
|
||||||
export default function addTests({ describe, it, firebase }) {
|
export default function addTests({ fdescribe, describe, it, firebase }) {
|
||||||
|
// it('works', () => {
|
||||||
|
// return new Promise((resolve) => {
|
||||||
|
// firebase.native.remoteConfig().enableDeveloperMode();
|
||||||
|
//
|
||||||
|
// firebase.native.remoteConfig().setDefaults({
|
||||||
|
// foobar: '123',
|
||||||
|
// barbaz: '345'
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// firebase.native.remoteConfig().fetch()
|
||||||
|
// .then(() => {
|
||||||
|
// return firebase.native.remoteConfig().activateFetched();
|
||||||
|
// })
|
||||||
|
// .then(() => {
|
||||||
|
// return firebase.native.remoteConfig().getValue('foobar')
|
||||||
|
// })
|
||||||
|
// .then((res) => {
|
||||||
|
// console.log('>>>>>', res.val())
|
||||||
|
// return Promise.resolve();
|
||||||
|
// })
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
describe('Analytics', () => {
|
describe('Analytics', () => {
|
||||||
it('logEvent: it should log a text event without error', () => {
|
it('logEvent: it should log a text event without error', () => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
function configTests({ tryCatch, before, fdescribe, it, firebase }) {
|
||||||
|
|
||||||
|
/* Remote config service values = {
|
||||||
|
foo: true,
|
||||||
|
foobar: 'barbaz',
|
||||||
|
} */
|
||||||
|
|
||||||
|
before(() => {
|
||||||
|
firebase.native.config().enableDeveloperMode();
|
||||||
|
firebase.native.config().setDefaults({
|
||||||
|
foo: 'bar',
|
||||||
|
bar: 'baz',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
fdescribe('Config', () => {
|
||||||
|
it('it should fetch and activate config', () => {
|
||||||
|
return firebase.native.config().fetch()
|
||||||
|
.then(() => {
|
||||||
|
return firebase.native.config().activateFetched();
|
||||||
|
})
|
||||||
|
.then((activated) => {
|
||||||
|
activated.should.be.a.Boolean();
|
||||||
|
return Promise.resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('it should get a single value by key', () => {
|
||||||
|
return firebase.native.config().getValue('foo')
|
||||||
|
.then((snapshot) => {
|
||||||
|
snapshot.should.be.a.Object();
|
||||||
|
snapshot.source.should.be.a.String();
|
||||||
|
snapshot.val.should.be.a.Function();
|
||||||
|
|
||||||
|
const value = snapshot.val();
|
||||||
|
value.should.be.equalOneOf('bar', true);
|
||||||
|
return Promise.resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('it should get multiple values by an array of keys', () => {
|
||||||
|
return firebase.native.config().getValues(['foo', 'bar', 'foobar'])
|
||||||
|
.then((result) => {
|
||||||
|
result.should.be.a.Object();
|
||||||
|
result.should.have.keys('foo', 'bar', 'foobar');
|
||||||
|
const fooValue = result.foo.val();
|
||||||
|
const barValue = result.bar.val();
|
||||||
|
const foobarValue = result.foobar.val();
|
||||||
|
|
||||||
|
fooValue.should.be.equal(true);
|
||||||
|
barValue.should.be.equal('baz');
|
||||||
|
foobarValue.should.be.equal('barbaz');
|
||||||
|
|
||||||
|
return Promise.resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default configTests;
|
|
@ -0,0 +1,10 @@
|
||||||
|
import firebase from '../../firebase';
|
||||||
|
import TestSuite from '../../../lib/TestSuite';
|
||||||
|
import configTests from './configTests';
|
||||||
|
|
||||||
|
const suite = new TestSuite('Crash', 'firebase.config()', firebase);
|
||||||
|
|
||||||
|
// bootstrap tests
|
||||||
|
suite.addTests(configTests);
|
||||||
|
|
||||||
|
export default suite;
|
|
@ -5,6 +5,7 @@ import database from './database/index';
|
||||||
import messaging from './messaging/index';
|
import messaging from './messaging/index';
|
||||||
import storage from './storage/index';
|
import storage from './storage/index';
|
||||||
import auth from './auth/index';
|
import auth from './auth/index';
|
||||||
|
import config from './config/index';
|
||||||
|
|
||||||
const testSuiteInstances = [
|
const testSuiteInstances = [
|
||||||
database,
|
database,
|
||||||
|
@ -13,6 +14,7 @@ const testSuiteInstances = [
|
||||||
messaging,
|
messaging,
|
||||||
crash,
|
crash,
|
||||||
storage,
|
storage,
|
||||||
|
config,
|
||||||
];
|
];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue