firebase / firebase-functions-test

MIT License
232 stars 48 forks source link

`makeChange` does not return `after` and `before` as functions #39

Closed idoshamun closed 5 years ago

idoshamun commented 5 years ago

Version info

firebase-functions-test: 0.1.3

firebase-functions: 2.0.2

firebase-admin: 5.13.1

Test case

The function makeChange returns an object with properties after and before which are objects instead of functions as described here: https://firebase.google.com/docs/firestore/extend-with-functions

Steps to reproduce

import firebaseFunctionTest from 'firebase-functions-test';
const projectId = process.env.GCLOUD_PROJECT;
  const test = firebaseFunctionTest({
    databaseURL: `https://${projectId}.firebaseio.com`,
    storageBucket: `${projectId}.appspot.com`,
    projectId,
  }, process.env.GOOGLE_APPLICATION_CREDENTIALS);
const change = test.makeChange({key: 'value'}, {key: 'value2'});

Expected behavior

change should have two properties after and before which are functions that return the provided objects.

Actual behavior

change has two properties after and before which are the provided objects.

idoshamun commented 5 years ago

I found out that it's my mistake, I need to provide DocumentSnapshot and not plain object