Files
react-native-firebase/tests/e2e/database/ref/priority.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

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');
});
});
});
});