Skip to content

Commit f3df3bd

Browse files
committed
added metadata to snapshot
1 parent bba6e25 commit f3df3bd

File tree

2 files changed

+71
-25
lines changed

2 files changed

+71
-25
lines changed

package-lock.json

Lines changed: 65 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/firestore-document-snapshot.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@
22

33
var _ = require('./lodash');
44

5-
function MockFirestoreDocumentSnapshot (id, ref, data) {
5+
function MockFirestoreDocumentSnapshot(id, ref, data) {
66
this.id = id;
77
this.ref = ref;
88
this._snapshotdata = _.cloneDeep(data) || null;
99
this.data = function() {
1010
return _.cloneDeep(this._snapshotdata);
1111
};
1212
this.exists = this._snapshotdata !== null;
13+
this.metadata = {
14+
fromCache: true,
15+
hasPendingWrites: false
16+
};
1317
}
1418

15-
MockFirestoreDocumentSnapshot.prototype.get = function (path) {
19+
MockFirestoreDocumentSnapshot.prototype.get = function(path) {
1620
if (!path || !this.exists) return undefined;
1721

1822
var parts = path.split('.');

0 commit comments

Comments
 (0)