Q: How to test firebase callable function with firestore I have a firebase callable function like
exports.getUserInfo = functions.https.onCall(async (data, context) => {
        const userIdRef = store.collection('UserID').doc('Document');
        let res = null;
        try {
            res = await store.runTransaction(async t => {
                const doc = await t.get(userIdRef);
                currentUserId = doc.data().ID;


                const newUserIdNum = currentUserId + 1;
                await t.update(userIdRef, {ID: newUserIdNum});
                let initUserData = {
                    'userID': newUserId,
                }
                return initUserData ;
            });
            console.log('Transaction success');
        } catch (e) {
            console.error('Transaction failure:', e);
        }

        return res;
})

but I am not sure how to create unit test about this. I want to mock UserID/Documment before I call
test.wrap(getUserInfo), like
const myFunctions = require('../index.js')
const getUserInfoWrapped = test.wrap(myFunctions.getUserInfo);

var assert = require('assert');
describe('User', function() {
        describe('getUserInfo()', function() {
                it('should create user', async function() {
                        // sample code, this won't work
                        const snapshot = test.firestore.makeDocumentSnapshot({ID: 1001}, 'UserID/Document');
                        const data = {}
                        const result = await getUserInfoWrapped (data, {});
                        assert.equal(result.userID, "1002");
                });
        });
});

seems this case not covered by firebase document
Reference:

*

*https://firebase.google.com/docs/functions/unit-testing

*https://github.com/firebase/firebase-functions-test/blob/c77aa92d345b8e4fb5ad98534989eb8dcf7d9bc4/spec/providers/https.spec.ts
