mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-23 20:10:05 +08:00
[database] cleanup linting issues
This commit is contained in:
@@ -19,7 +19,10 @@
|
||||
|
||||
describe('database().ref().onDisconnect()', () => {
|
||||
it('returns a new DatabaseOnDisconnect instance', () => {
|
||||
const instance = firebase.database().ref().onDisconnect();
|
||||
const instance = firebase
|
||||
.database()
|
||||
.ref()
|
||||
.onDisconnect();
|
||||
instance.constructor.name.should.eql('DatabaseOnDisconnect');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,16 +15,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
const { PATH, seed, wipe } = require('../helpers');
|
||||
// const { PATH, seed, wipe } = require('../helpers');
|
||||
|
||||
const TEST_PATH = `${PATH}/push`;
|
||||
|
||||
describe('database().ref().push()', () => {
|
||||
// const TEST_PATH = `${PATH}/push`;
|
||||
|
||||
xdescribe('database().ref().push()', () => {
|
||||
// before(() => seed(TEST_PATH));
|
||||
// after(() => wipe(TEST_PATH));
|
||||
|
||||
|
||||
// TODO
|
||||
|
||||
});
|
||||
|
||||
@@ -20,13 +20,15 @@ const { PATH, seed, wipe } = require('../helpers');
|
||||
const TEST_PATH = `${PATH}/set`;
|
||||
|
||||
describe('database().ref().set()', () => {
|
||||
|
||||
before(() => seed(TEST_PATH));
|
||||
after(() => wipe(TEST_PATH));
|
||||
|
||||
it('throws if no value is provided', async () => {
|
||||
try {
|
||||
await firebase.database().ref(TEST_PATH).set();
|
||||
await firebase
|
||||
.database()
|
||||
.ref(TEST_PATH)
|
||||
.set();
|
||||
return Promise.reject(new Error('Did not throw an Error.'));
|
||||
} catch (error) {
|
||||
error.message.should.containEql(`'value' must be defined`);
|
||||
@@ -36,7 +38,10 @@ describe('database().ref().set()', () => {
|
||||
|
||||
it('throws if onComplete is not a function', async () => {
|
||||
try {
|
||||
await firebase.database().ref(TEST_PATH).set(null, 'foo');
|
||||
await firebase
|
||||
.database()
|
||||
.ref(TEST_PATH)
|
||||
.set(null, 'foo');
|
||||
return Promise.reject(new Error('Did not throw an Error.'));
|
||||
} catch (error) {
|
||||
error.message.should.containEql(`'onComplete' must be a function if provided`);
|
||||
|
||||
@@ -20,13 +20,15 @@ const { PATH, CONTENT, seed, wipe } = require('../helpers');
|
||||
const TEST_PATH = `${PATH}/priority`;
|
||||
|
||||
describe('database().ref().setPriority()', () => {
|
||||
|
||||
before(() => seed(TEST_PATH));
|
||||
after(() => wipe(TEST_PATH));
|
||||
|
||||
it('throws if priority is not a valid type', async () => {
|
||||
try {
|
||||
await firebase.database().ref().setPriority({});
|
||||
await firebase
|
||||
.database()
|
||||
.ref()
|
||||
.setPriority({});
|
||||
return Promise.reject(new Error('Did not throw an Error.'));
|
||||
} catch (error) {
|
||||
error.message.should.containEql(`'priority' must be a number, string or null value`);
|
||||
@@ -36,7 +38,10 @@ describe('database().ref().setPriority()', () => {
|
||||
|
||||
it('throws if onComplete is not a function', async () => {
|
||||
try {
|
||||
await firebase.database().ref().setPriority(null, 'foo');
|
||||
await firebase
|
||||
.database()
|
||||
.ref()
|
||||
.setPriority(null, 'foo');
|
||||
return Promise.reject(new Error('Did not throw an Error.'));
|
||||
} catch (error) {
|
||||
error.message.should.containEql(`'onComplete' must be a function if provided`);
|
||||
|
||||
@@ -15,12 +15,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
const { PATH, CONTENT, seed, wipe } = require('../helpers');
|
||||
const { PATH, seed, wipe } = require('../helpers');
|
||||
|
||||
const TEST_PATH = `${PATH}/setWithPriority`;
|
||||
|
||||
describe('database().ref().setWithPriority()', () => {
|
||||
|
||||
before(() => seed(TEST_PATH));
|
||||
after(() => wipe(TEST_PATH));
|
||||
|
||||
|
||||
@@ -56,9 +56,12 @@ describe('database().ref().update()', () => {
|
||||
await firebase
|
||||
.database()
|
||||
.ref(`${PATH}/update`)
|
||||
.update({
|
||||
foo: 'bar',
|
||||
}, 'foo');
|
||||
.update(
|
||||
{
|
||||
foo: 'bar',
|
||||
},
|
||||
'foo',
|
||||
);
|
||||
return Promise.reject(new Error('Did not throw an Error.'));
|
||||
} catch (error) {
|
||||
error.message.should.containEql(`'onComplete' must be a function if provided`);
|
||||
|
||||
Reference in New Issue
Block a user