added test for issue #100
This commit is contained in:
parent
286f886cfa
commit
c8a3440fd4
@ -15,11 +15,12 @@ import refTests from './refTests';
|
||||
import rootTests from './rootTests';
|
||||
import transactionTests from './transactionTests';
|
||||
import queryTests from './queryTests';
|
||||
import issueSpecificTests from './issueSpecificTests';
|
||||
|
||||
import DatabaseContents from '../../support/DatabaseContents';
|
||||
|
||||
const testGroups = [
|
||||
factoryTests, keyTests, parentTests, childTests, rootTests,
|
||||
issueSpecificTests, factoryTests, keyTests, parentTests, childTests, rootTests,
|
||||
pushTests, onTests, onValueTests, offTests, onceTests, updateTests,
|
||||
removeTests, setTests, transactionTests, queryTests, refTests, isEqualTests,
|
||||
];
|
||||
@ -29,10 +30,12 @@ function registerTestSuite(testSuite) {
|
||||
this._databaseRef = testSuite.firebase.native.database().ref('tests/types');
|
||||
|
||||
await this._databaseRef.set(DatabaseContents.DEFAULT);
|
||||
await this._databaseRef.parent.child('issues').set(DatabaseContents.ISSUES);
|
||||
});
|
||||
|
||||
testSuite.afterEach(async function () {
|
||||
await this._databaseRef.set(DatabaseContents.DEFAULT);
|
||||
await this._databaseRef.parent.child('issues').set(DatabaseContents.ISSUES);
|
||||
});
|
||||
|
||||
testGroups.forEach((testGroup) => {
|
||||
|
24
tests/src/tests/database/ref/issueSpecificTests.js
Normal file
24
tests/src/tests/database/ref/issueSpecificTests.js
Normal file
@ -0,0 +1,24 @@
|
||||
import DatabaseContents from '../../support/DatabaseContents';
|
||||
|
||||
function childTests({ fdescribe, it, context, firebase }) {
|
||||
fdescribe('issue_100', () => {
|
||||
context('returned snapshot should match web API', () => {
|
||||
it('returns correct child ref', async () => {
|
||||
// Setup
|
||||
|
||||
const ref = firebase.native.database().ref('tests/issues/100');
|
||||
|
||||
// Test
|
||||
|
||||
return ref.once('value').then((snapshot) => {
|
||||
// Assertion
|
||||
console.warn(JSON.stringify(snapshot.val()));
|
||||
|
||||
snapshot.val().should.eql(DatabaseContents.ISSUES[100]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default childTests;
|
@ -15,11 +15,11 @@ import DatabaseContents from '../../../support/DatabaseContents';
|
||||
*/
|
||||
const DATATYPES_WITH_DUPLICATE_CALLBACK_CALLS = [
|
||||
'array',
|
||||
'number'
|
||||
'number',
|
||||
];
|
||||
|
||||
function onTests({ fdescribe, context, it, firebase, tryCatch }) {
|
||||
fdescribe('ref().on(\'value\')', () => {
|
||||
function onTests({ describe, context, it, firebase, tryCatch }) {
|
||||
describe('ref().on(\'value\')', () => {
|
||||
// Documented Web API Behaviour
|
||||
it('returns the success callback', () => {
|
||||
// Setup
|
||||
|
@ -22,4 +22,22 @@ export default {
|
||||
foo: 'baz',
|
||||
},
|
||||
},
|
||||
|
||||
ISSUES: {
|
||||
// https://github.com/invertase/react-native-firebase/issues/100
|
||||
100: {
|
||||
1: {
|
||||
someKey: 'someValue',
|
||||
someOtherKey: 'someOtherValue',
|
||||
},
|
||||
2: {
|
||||
someKey: 'someValue',
|
||||
someOtherKey: 'someOtherValue',
|
||||
},
|
||||
3: {
|
||||
someKey: 'someValue',
|
||||
someOtherKey: 'someOtherValue',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user