mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-05-06 16:40:30 +08:00
- [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.
25 lines
680 B
JavaScript
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);
|
|
});
|
|
});
|
|
});
|