[firestore] Add support for GetOptions #1248

This commit is contained in:
Chris Bianca
2018-07-03 16:03:43 +01:00
parent 43615ffcf6
commit a79bf81418
23 changed files with 2829 additions and 2610 deletions

View File

@@ -93,6 +93,26 @@ function documentReferenceTests({
snapshot.id.should.equal('doc1');
snapshot.metadata.should.be.an.Object();
});
it('should support GetOptions source=`default`', async () => {
const snapshot = await firebase.native
.firestore()
.doc('document-tests/doc1')
.get({ source: 'default' });
snapshot.id.should.equal('doc1');
snapshot.metadata.should.be.an.Object();
should.equal(snapshot.metadata.fromCache, false);
});
it('should support GetOptions source=`cache`', async () => {
const snapshot = await firebase.native
.firestore()
.doc('document-tests/doc1')
.get({ source: 'cache' });
snapshot.id.should.equal('doc1');
snapshot.metadata.should.be.an.Object();
should.equal(snapshot.metadata.fromCache, true);
});
});
context('onSnapshot()', () => {