Add missing firestore tests
This commit is contained in:
parent
7ec62f9415
commit
fdd8df6966
|
@ -164,7 +164,7 @@ PODS:
|
||||||
- React/Core
|
- React/Core
|
||||||
- React/fishhook
|
- React/fishhook
|
||||||
- React/RCTBlob
|
- React/RCTBlob
|
||||||
- RNFirebase (3.2.4):
|
- RNFirebase (3.2.7):
|
||||||
- React
|
- React
|
||||||
- yoga (0.52.0.React)
|
- yoga (0.52.0.React)
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ SPEC CHECKSUMS:
|
||||||
nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3
|
nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3
|
||||||
Protobuf: 8a9838fba8dae3389230e1b7f8c104aa32389c03
|
Protobuf: 8a9838fba8dae3389230e1b7f8c104aa32389c03
|
||||||
React: 61a6bdf17a9ff16875c230e6ff278d9de274e16c
|
React: 61a6bdf17a9ff16875c230e6ff278d9de274e16c
|
||||||
RNFirebase: 011e47909cf54070f72d50b8d61eb7b347774d29
|
RNFirebase: 3a141a97041ea0757e2036c2bb18acbe9f0e105d
|
||||||
yoga: 646606bf554d54a16711f35596178522fbc00480
|
yoga: 646606bf554d54a16711f35596178522fbc00480
|
||||||
|
|
||||||
PODFILE CHECKSUM: 67c98bcb203cb992da590bcab6f690f727653ca5
|
PODFILE CHECKSUM: 67c98bcb203cb992da590bcab6f690f727653ca5
|
||||||
|
|
|
@ -26,6 +26,15 @@ function collectionReferenceTests({
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
context('parent', () => {
|
||||||
|
it('should return parent document', () => {
|
||||||
|
const collection = firebase.native
|
||||||
|
.firestore()
|
||||||
|
.collection('collection/document/subcollection');
|
||||||
|
collection.parent.path.should.equal('collection/document');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
context('add()', () => {
|
context('add()', () => {
|
||||||
it('should create Document', () =>
|
it('should create Document', () =>
|
||||||
firebase.native
|
firebase.native
|
||||||
|
@ -51,6 +60,15 @@ function collectionReferenceTests({
|
||||||
should.equal(docRef.path, 'collection-tests/doc');
|
should.equal(docRef.path, 'collection-tests/doc');
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should error when supplied an incorrect path', () => {
|
||||||
|
(() => {
|
||||||
|
firebase.native
|
||||||
|
.firestore()
|
||||||
|
.collection('collection')
|
||||||
|
.doc('invalid/doc');
|
||||||
|
}).should.throw('Argument "documentPath" must point to a document.');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
context('get()', () => {
|
context('get()', () => {
|
||||||
|
@ -68,6 +86,47 @@ function collectionReferenceTests({
|
||||||
});
|
});
|
||||||
|
|
||||||
context('onSnapshot()', () => {
|
context('onSnapshot()', () => {
|
||||||
|
it('QuerySnapshot has correct properties', async () => {
|
||||||
|
const snapshot = await firebase.native
|
||||||
|
.firestore()
|
||||||
|
.collection('collection-tests')
|
||||||
|
.get();
|
||||||
|
|
||||||
|
snapshot.docChanges.should.be.an.Array();
|
||||||
|
snapshot.empty.should.equal(false);
|
||||||
|
snapshot.metadata.should.be.an.Object();
|
||||||
|
snapshot.query.should.be.an.Object();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('DocumentChange has correct properties', async () => {
|
||||||
|
const collectionRef = firebase.native
|
||||||
|
.firestore()
|
||||||
|
.collection('collection-tests');
|
||||||
|
|
||||||
|
// Test
|
||||||
|
|
||||||
|
let unsubscribe;
|
||||||
|
let changes;
|
||||||
|
await new Promise(resolve2 => {
|
||||||
|
unsubscribe = collectionRef.onSnapshot(snapshot => {
|
||||||
|
changes = snapshot.docChanges;
|
||||||
|
resolve2();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assertions
|
||||||
|
|
||||||
|
changes.should.be.a.Array();
|
||||||
|
changes[0].doc.should.be.an.Object();
|
||||||
|
changes[0].newIndex.should.be.a.Number();
|
||||||
|
changes[0].oldIndex.should.be.a.Number();
|
||||||
|
changes[0].type.should.be.a.String();
|
||||||
|
|
||||||
|
// Tear down
|
||||||
|
|
||||||
|
unsubscribe();
|
||||||
|
});
|
||||||
|
|
||||||
it('calls callback with the initial data and then when document changes', async () => {
|
it('calls callback with the initial data and then when document changes', async () => {
|
||||||
const collectionRef = firebase.native
|
const collectionRef = firebase.native
|
||||||
.firestore()
|
.firestore()
|
||||||
|
@ -104,9 +163,7 @@ function collectionReferenceTests({
|
||||||
|
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
context('onSnapshot()', () => {
|
|
||||||
it('calls callback with the initial data and then when document is added', async () => {
|
it('calls callback with the initial data and then when document is added', async () => {
|
||||||
const collectionRef = firebase.native
|
const collectionRef = firebase.native
|
||||||
.firestore()
|
.firestore()
|
||||||
|
@ -144,9 +201,7 @@ function collectionReferenceTests({
|
||||||
|
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
context('onSnapshot()', () => {
|
|
||||||
it("doesn't call callback when the ref is updated with the same value", async () => {
|
it("doesn't call callback when the ref is updated with the same value", async () => {
|
||||||
const collectionRef = firebase.native
|
const collectionRef = firebase.native
|
||||||
.firestore()
|
.firestore()
|
||||||
|
@ -181,9 +236,7 @@ function collectionReferenceTests({
|
||||||
|
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
context('onSnapshot()', () => {
|
|
||||||
it('allows binding multiple callbacks to the same ref', async () => {
|
it('allows binding multiple callbacks to the same ref', async () => {
|
||||||
// Setup
|
// Setup
|
||||||
const collectionRef = firebase.native
|
const collectionRef = firebase.native
|
||||||
|
@ -234,9 +287,7 @@ function collectionReferenceTests({
|
||||||
unsubscribeA();
|
unsubscribeA();
|
||||||
unsubscribeB();
|
unsubscribeB();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
context('onSnapshot()', () => {
|
|
||||||
it('listener stops listening when unsubscribed', async () => {
|
it('listener stops listening when unsubscribed', async () => {
|
||||||
// Setup
|
// Setup
|
||||||
const collectionRef = firebase.native
|
const collectionRef = firebase.native
|
||||||
|
@ -310,9 +361,7 @@ function collectionReferenceTests({
|
||||||
callbackA.should.be.calledTwice();
|
callbackA.should.be.calledTwice();
|
||||||
callbackB.should.be.calledThrice();
|
callbackB.should.be.calledThrice();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
context('onSnapshot()', () => {
|
|
||||||
it('supports options and callback', async () => {
|
it('supports options and callback', async () => {
|
||||||
const collectionRef = firebase.native
|
const collectionRef = firebase.native
|
||||||
.firestore()
|
.firestore()
|
||||||
|
@ -354,9 +403,7 @@ function collectionReferenceTests({
|
||||||
|
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
context('onSnapshot()', () => {
|
|
||||||
it('supports observer', async () => {
|
it('supports observer', async () => {
|
||||||
const collectionRef = firebase.native
|
const collectionRef = firebase.native
|
||||||
.firestore()
|
.firestore()
|
||||||
|
@ -396,9 +443,7 @@ function collectionReferenceTests({
|
||||||
|
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
context('onSnapshot()', () => {
|
|
||||||
it('supports options and observer', async () => {
|
it('supports options and observer', async () => {
|
||||||
const collectionRef = firebase.native
|
const collectionRef = firebase.native
|
||||||
.firestore()
|
.firestore()
|
||||||
|
@ -416,6 +461,7 @@ function collectionReferenceTests({
|
||||||
snapshot.forEach(doc => callback(doc.data()));
|
snapshot.forEach(doc => callback(doc.data()));
|
||||||
resolve2();
|
resolve2();
|
||||||
},
|
},
|
||||||
|
error: () => {},
|
||||||
};
|
};
|
||||||
unsubscribe = collectionRef.onSnapshot(
|
unsubscribe = collectionRef.onSnapshot(
|
||||||
{
|
{
|
||||||
|
@ -443,6 +489,84 @@ function collectionReferenceTests({
|
||||||
|
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('errors when invalid parameters supplied', async () => {
|
||||||
|
const colRef = firebase.native
|
||||||
|
.firestore()
|
||||||
|
.collection('collection-tests');
|
||||||
|
|
||||||
|
(() => {
|
||||||
|
colRef.onSnapshot(() => {}, 'error');
|
||||||
|
}).should.throw(
|
||||||
|
'Query.onSnapshot failed: Second argument must be a valid function.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
colRef.onSnapshot({
|
||||||
|
next: () => {},
|
||||||
|
error: 'error',
|
||||||
|
});
|
||||||
|
}).should.throw(
|
||||||
|
'Query.onSnapshot failed: Observer.error must be a valid function.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
colRef.onSnapshot(
|
||||||
|
{
|
||||||
|
includeQueryMetadataChanges: true,
|
||||||
|
},
|
||||||
|
() => {},
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
}).should.throw(
|
||||||
|
'Query.onSnapshot failed: Third argument must be a valid function.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
colRef.onSnapshot(
|
||||||
|
{
|
||||||
|
includeQueryMetadataChanges: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
next: () => {},
|
||||||
|
error: 'error',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}).should.throw(
|
||||||
|
'Query.onSnapshot failed: Observer.error must be a valid function.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
colRef.onSnapshot(
|
||||||
|
{
|
||||||
|
includeQueryMetadataChanges: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
next: 'error',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}).should.throw(
|
||||||
|
'Query.onSnapshot failed: Observer.next must be a valid function.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
colRef.onSnapshot(
|
||||||
|
{
|
||||||
|
includeQueryMetadataChanges: true,
|
||||||
|
},
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
}).should.throw(
|
||||||
|
'Query.onSnapshot failed: Second argument must be a function or observer.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
colRef.onSnapshot({
|
||||||
|
error: 'error',
|
||||||
|
});
|
||||||
|
}).should.throw(
|
||||||
|
'Query.onSnapshot failed: First argument must be a function, observer or options.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
colRef.onSnapshot();
|
||||||
|
}).should.throw(
|
||||||
|
'Query.onSnapshot failed: Called with invalid arguments.'
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Where
|
// Where
|
||||||
|
|
|
@ -17,6 +17,28 @@ function documentReferenceTests({ describe, it, context, firebase }) {
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
context('id', () => {
|
||||||
|
it('should return document id', () => {
|
||||||
|
const document = firebase.native.firestore().doc('documents/doc1');
|
||||||
|
document.id.should.equal('doc1');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
context('parent', () => {
|
||||||
|
it('should return parent collection', () => {
|
||||||
|
const document = firebase.native.firestore().doc('documents/doc1');
|
||||||
|
document.parent.id.should.equal('documents');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
context('collection()', () => {
|
||||||
|
it('should return a child collection', () => {
|
||||||
|
const document = firebase.native.firestore().doc('documents/doc1');
|
||||||
|
const collection = document.collection('pages');
|
||||||
|
collection.id.should.equal('pages');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
context('delete()', () => {
|
context('delete()', () => {
|
||||||
it('should delete Document', () =>
|
it('should delete Document', () =>
|
||||||
firebase.native
|
firebase.native
|
||||||
|
@ -32,6 +54,17 @@ function documentReferenceTests({ describe, it, context, firebase }) {
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
context('get()', () => {
|
||||||
|
it('DocumentSnapshot should have correct properties', async () => {
|
||||||
|
const snapshot = await firebase.native
|
||||||
|
.firestore()
|
||||||
|
.doc('document-tests/doc1')
|
||||||
|
.get();
|
||||||
|
snapshot.id.should.equal('doc1');
|
||||||
|
snapshot.metadata.should.be.an.Object();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
context('onSnapshot()', () => {
|
context('onSnapshot()', () => {
|
||||||
it('calls callback with the initial data and then when value changes', async () => {
|
it('calls callback with the initial data and then when value changes', async () => {
|
||||||
const docRef = firebase.native.firestore().doc('document-tests/doc1');
|
const docRef = firebase.native.firestore().doc('document-tests/doc1');
|
||||||
|
@ -321,6 +354,7 @@ function documentReferenceTests({ describe, it, context, firebase }) {
|
||||||
callback(snapshot.data());
|
callback(snapshot.data());
|
||||||
resolve2();
|
resolve2();
|
||||||
},
|
},
|
||||||
|
error: () => {},
|
||||||
};
|
};
|
||||||
unsubscribe = docRef.onSnapshot(
|
unsubscribe = docRef.onSnapshot(
|
||||||
{ includeMetadataChanges: true },
|
{ includeMetadataChanges: true },
|
||||||
|
@ -346,6 +380,88 @@ function documentReferenceTests({ describe, it, context, firebase }) {
|
||||||
|
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('errors when invalid parameters supplied', async () => {
|
||||||
|
const docRef = firebase.native.firestore().doc('document-tests/doc1');
|
||||||
|
(() => {
|
||||||
|
docRef.onSnapshot(() => {}, 'error');
|
||||||
|
}).should.throw(
|
||||||
|
'DocumentReference.onSnapshot failed: Second argument must be a valid function.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
docRef.onSnapshot({
|
||||||
|
next: () => {},
|
||||||
|
error: 'error',
|
||||||
|
});
|
||||||
|
}).should.throw(
|
||||||
|
'DocumentReference.onSnapshot failed: Observer.error must be a valid function.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
docRef.onSnapshot({
|
||||||
|
next: 'error',
|
||||||
|
});
|
||||||
|
}).should.throw(
|
||||||
|
'DocumentReference.onSnapshot failed: Observer.next must be a valid function.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
docRef.onSnapshot(
|
||||||
|
{
|
||||||
|
includeMetadataChanges: true,
|
||||||
|
},
|
||||||
|
() => {},
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
}).should.throw(
|
||||||
|
'DocumentReference.onSnapshot failed: Third argument must be a valid function.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
docRef.onSnapshot(
|
||||||
|
{
|
||||||
|
includeMetadataChanges: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
next: () => {},
|
||||||
|
error: 'error',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}).should.throw(
|
||||||
|
'DocumentReference.onSnapshot failed: Observer.error must be a valid function.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
docRef.onSnapshot(
|
||||||
|
{
|
||||||
|
includeMetadataChanges: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
next: 'error',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}).should.throw(
|
||||||
|
'DocumentReference.onSnapshot failed: Observer.next must be a valid function.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
docRef.onSnapshot(
|
||||||
|
{
|
||||||
|
includeMetadataChanges: true,
|
||||||
|
},
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
}).should.throw(
|
||||||
|
'DocumentReference.onSnapshot failed: Second argument must be a function or observer.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
docRef.onSnapshot({
|
||||||
|
error: 'error',
|
||||||
|
});
|
||||||
|
}).should.throw(
|
||||||
|
'DocumentReference.onSnapshot failed: First argument must be a function, observer or options.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
docRef.onSnapshot();
|
||||||
|
}).should.throw(
|
||||||
|
'DocumentReference.onSnapshot failed: Called with invalid arguments.'
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
context('set()', () => {
|
context('set()', () => {
|
||||||
|
@ -464,6 +580,25 @@ function documentReferenceTests({ describe, it, context, firebase }) {
|
||||||
doc.data().nested.firstname.should.equal('First Name');
|
doc.data().nested.firstname.should.equal('First Name');
|
||||||
doc.data().nested.lastname.should.equal('Last Name');
|
doc.data().nested.lastname.should.equal('Last Name');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('errors when invalid parameters supplied', async () => {
|
||||||
|
const docRef = firebase.native.firestore().doc('document-tests/doc1');
|
||||||
|
(() => {
|
||||||
|
docRef.update('error');
|
||||||
|
}).should.throw(
|
||||||
|
'DocumentReference.update failed: If using a single argument, it must be an object.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
docRef.update('error1', 'error2', 'error3');
|
||||||
|
}).should.throw(
|
||||||
|
'DocumentReference.update failed: Must have either a single object argument, or equal numbers of key/value pairs.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
docRef.update(0, 'error');
|
||||||
|
}).should.throw(
|
||||||
|
'DocumentReference.update failed: Argument at index 0 must be a string or FieldPath'
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
context('types', () => {
|
context('types', () => {
|
||||||
|
|
|
@ -2,6 +2,13 @@ import should from 'should';
|
||||||
|
|
||||||
function fieldPathTests({ describe, it, context, firebase }) {
|
function fieldPathTests({ describe, it, context, firebase }) {
|
||||||
describe('FieldPath', () => {
|
describe('FieldPath', () => {
|
||||||
|
context('documentId', () => {
|
||||||
|
it('should be a FieldPath', () => {
|
||||||
|
const documentId = firebase.native.firestore.FieldPath.documentId();
|
||||||
|
documentId.should.be.instanceof(firebase.native.firestore.FieldPath);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
context('DocumentSnapshot.get()', () => {
|
context('DocumentSnapshot.get()', () => {
|
||||||
it('should get the correct values', () =>
|
it('should get the correct values', () =>
|
||||||
firebase.native
|
firebase.native
|
||||||
|
|
|
@ -11,6 +11,14 @@ function firestoreTests({ describe, it, context, firebase }) {
|
||||||
should.equal(collectionRef.id, 'collection2');
|
should.equal(collectionRef.id, 'collection2');
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should error if invalid collection path supplied', () => {
|
||||||
|
(() => {
|
||||||
|
firebase.native.firestore().collection('collection1/doc1');
|
||||||
|
}).should.throw(
|
||||||
|
'Argument "collectionPath" must point to a collection.'
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
context('doc()', () => {
|
context('doc()', () => {
|
||||||
|
@ -22,6 +30,12 @@ function firestoreTests({ describe, it, context, firebase }) {
|
||||||
should.equal(docRef.path, 'collection1/doc1/collection2/doc2');
|
should.equal(docRef.path, 'collection1/doc1/collection2/doc2');
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should error if invalid document path supplied', () => {
|
||||||
|
(() => {
|
||||||
|
firebase.native.firestore().doc('collection1');
|
||||||
|
}).should.throw('Argument "documentPath" must point to a document.');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
context('batch()', () => {
|
context('batch()', () => {
|
||||||
|
@ -90,6 +104,54 @@ function firestoreTests({ describe, it, context, firebase }) {
|
||||||
sfDoc.data().nested.lastname.should.equal('Last Name');
|
sfDoc.data().nested.lastname.should.equal('Last Name');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('errors when invalid parameters supplied', async () => {
|
||||||
|
const ref = firebase.native.firestore().doc('collection/doc');
|
||||||
|
const batch = firebase.native.firestore().batch();
|
||||||
|
(() => {
|
||||||
|
batch.update(ref, 'error');
|
||||||
|
}).should.throw(
|
||||||
|
'WriteBatch.update failed: If using two arguments, the second must be an object.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
batch.update(ref, 'error1', 'error2', 'error3');
|
||||||
|
}).should.throw(
|
||||||
|
'WriteBatch.update failed: Must have a document reference, followed by either a single object argument, or equal numbers of key/value pairs.'
|
||||||
|
);
|
||||||
|
(() => {
|
||||||
|
batch.update(ref, 0, 'error');
|
||||||
|
}).should.throw(
|
||||||
|
'WriteBatch.update failed: Argument at index 0 must be a string or FieldPath'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
context('enablePersistence()', () => {
|
||||||
|
it('should throw an unsupported error', () => {
|
||||||
|
(() => {
|
||||||
|
firebase.native.firestore().enablePersistence();
|
||||||
|
}).should.throw(
|
||||||
|
'Persistence is enabled by default on the Firestore SDKs'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
context('setLogLevel()', () => {
|
||||||
|
it('should throw an unsupported error', () => {
|
||||||
|
(() => {
|
||||||
|
firebase.native.firestore().setLogLevel();
|
||||||
|
}).should.throw(
|
||||||
|
'firebase.firestore().setLogLevel() is unsupported by the native Firebase SDKs.'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
context('settings()', () => {
|
||||||
|
it('should throw an unsupported error', () => {
|
||||||
|
(() => {
|
||||||
|
firebase.native.firestore().settings();
|
||||||
|
}).should.throw('firebase.firestore().settings() coming soon');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue