Files
react-native-firebase/tests/e2e/database/ref/factory.e2e.js
Michael Diarmid d3b9b24cca [android][database] database improvements (#1619)
- [ANDROID] [BUGFIX] [DATABASE] - Database listeners now correctly tearing down between RN reloads. (Fixes #1498 #1611 #1609)
 - [JS] [BUGFIX] [DATABASE] - Fixed an issue where `Reference.toString()` incorrectly contains `//` instead of `/` when joining the parent and child paths.
 - [JS] [BUGFIX] [DATABASE] - Rework `.push()` behaviour to match WebSDK and correctly return a Reference instance in all scenarios. (Fixes #893 #1464 #1572)
 - [JS] [ENHANCEMENT] [UTILS] - Added a `firebase.utils().database.cleanup()` utility method which removes all database listeners.
2018-10-27 05:34:09 +01:00

25 lines
680 B
JavaScript

const { CONTENTS, setDatabaseContents } = TestHelpers.database;
describe('database()', () => {
before(() => setDatabaseContents());
describe('ref()', () => {
it('returns root reference when provided no path', () => {
const ref = firebase.database().ref();
(ref.key === null).should.be.true();
(ref.parent === null).should.be.true();
});
it('returns reference to data at path', async () => {
const ref = firebase.database().ref('tests/types/number');
let valueAtRef;
await ref.once('value', snapshot => {
valueAtRef = snapshot.val();
});
valueAtRef.should.eql(CONTENTS.DEFAULT.number);
});
});
});