function createFirestoreProfileRefStub() {
  let profileUpdate = {}
  return {
    update: createSuccessStub(),
    set: sinon.spy((setData) => {
      // Fail automatically for intentionally rejected promise
      // (used in testing that rejecting set promise is handled)
      if (setData === 'fail') {
        return Promise.reject(new Error('test'))
      }
      // Emulate Firebase's error for trying to call update without an object
      if (!isObject(setData)) {
        return Promise.reject(
          new Error(
            'Reference.update failed: First argument  must be an object containing the children to replace.'
          )
        )
      }
      profileUpdate = setData
      return Promise.resolve()
    }),
    get: createSuccessStub({
      data: () => ({ ...existingProfile, ...profileUpdate })
    })
  }
}
Create an object representing a "profileReference" (a Firebase
Firestore Reference for the current user's profile document) which
contains Sinon stubs in place of Firebase JS SDK methods (such as
update and get)

@returns {object}