mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-05-21 07:32:47 +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.
34 lines
1000 B
JavaScript
34 lines
1000 B
JavaScript
const { CONTENTS, setDatabaseContents } = TestHelpers.database;
|
|
|
|
describe('database()', () => {
|
|
before(() => setDatabaseContents());
|
|
|
|
describe('ref().priority', () => {
|
|
it('setPriority() should correctly set a priority for all non-null values', async () => {
|
|
await Promise.all(
|
|
Object.keys(CONTENTS.DEFAULT).map(async dataRef => {
|
|
const ref = firebase.database().ref(`tests/types/${dataRef}`);
|
|
|
|
await ref.setPriority(1);
|
|
|
|
await ref.once('value').then(snapshot => {
|
|
if (snapshot.val() !== null) {
|
|
snapshot.getPriority().should.eql(1);
|
|
}
|
|
});
|
|
})
|
|
);
|
|
});
|
|
|
|
it('setWithPriority() should correctly set the priority', async () => {
|
|
const ref = firebase.database().ref('tests/types/number');
|
|
|
|
await ref.setWithPriority(CONTENTS.DEFAULT.number, '2');
|
|
|
|
await ref.once('value').then(snapshot => {
|
|
snapshot.getPriority().should.eql('2');
|
|
});
|
|
});
|
|
});
|
|
});
|