mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-05-28 23:51:09 +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.
33 lines
967 B
JavaScript
33 lines
967 B
JavaScript
const { setDatabaseContents } = TestHelpers.database;
|
|
|
|
describe('database()', () => {
|
|
before(() => setDatabaseContents());
|
|
|
|
describe('ref().isEqual()', () => {
|
|
before(() => {
|
|
this.ref = firebase.database().ref('tests/types');
|
|
});
|
|
|
|
it('returns true when the reference is for the same location', () => {
|
|
const ref = firebase.database().ref();
|
|
ref.ref.should.eql(ref);
|
|
|
|
const ref2 = firebase.database().ref('tests/types');
|
|
this.ref.isEqual(ref2).should.eql(true);
|
|
});
|
|
|
|
it('returns false when the reference is for a different location', () => {
|
|
const ref2 = firebase.database().ref('tests/types/number');
|
|
this.ref.isEqual(ref2).should.eql(false);
|
|
});
|
|
|
|
it('returns false when the reference is null', () => {
|
|
this.ref.isEqual(null).should.eql(false);
|
|
});
|
|
|
|
it('returns false when the reference is not a Reference', () => {
|
|
this.ref.isEqual(1).should.eql(false);
|
|
});
|
|
});
|
|
});
|