-
Notifications
You must be signed in to change notification settings - Fork 60
Closed
Description
Version info
firebase-functions-test: 0.1.3
firebase-functions: 2.0.5
firebase-admin: 6.0.0
Steps to reproduce
Create a test and call makeDocumentSnapshot
with an object that contains a DocumentReference
import * as _test from 'firebase-functions-test';
import { DocumentReference, DocumentSnapshot } from '@google-cloud/firestore';
const test: FeaturesList = _test();
// inside a test
const foo: DocumentReference = admin.firestore().doc('documents/foo');
const bar: any = { docRef };
const snap: DocumentSnapshot = test.firestore.makeDocumentSnapshot(document, 'documents/bar');
Expected behaviour
Create a mocked DocumentSnapshot with data that contains document references. So we can test references within our models.
Actual behaviour
Error: Cannot encode [object Object]to a Firestore Value. Local testing does not yet support Firestore document reference values or geo points.
at encodeHelper (node_modules/firebase-functions-test/lib/providers/firestore.js:161:15)
at /fake/project/path/node_modules/lodash/lodash.js:13402:38
at /fake/project/path/node_modules/lodash/lodash.js:4911:15
at baseForOwn (node_modules/lodash/lodash.js:2996:24)
at Function.mapValues (node_modules/lodash/lodash.js:13401:7)
at objectToValueProto (node_modules/firebase-functions-test/lib/providers/firestore.js:164:21)
at encodeHelper (node_modules/firebase-functions-test/lib/providers/firestore.js:146:29)
at /fake/project/path/node_modules/lodash/lodash.js:13402:38
at /fake/project/path/node_modules/lodash/lodash.js:4911:15
at baseForOwn (node_modules/lodash/lodash.js:2996:24)
at Function.mapValues (node_modules/lodash/lodash.js:13401:7)
at objectToValueProto (node_modules/firebase-functions-test/lib/providers/firestore.js:164:21)
at Object.makeDocumentSnapshot (node_modules/firebase-functions-test/lib/providers/firestore.js:49:17)
at Object.<anonymous> (src/test.online.spec.ts:43:22)
at Generator.next (<anonymous>)
at fulfilled (src/test.online.spec.ts:4:58)
Metadata
Metadata
Assignees
Labels
No labels