I am trying to set up unit testing for my firebase cloud-function. but getting this error
Error: Wrap function is only available for
onCallHTTP functions, notonRequest.
this is how my app.test.ts looks like
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-unused-vars */
import {stub} from "sinon";
import * as admin from "firebase-admin";
import funcTest from "firebase-functions-test";
admin.initializeApp();
describe("Index Test", function() {
let adminInitStub:any;
let appCloudFunction:any;
const test = funcTest();
before(async () => {
adminInitStub = stub(admin, "initializeApp");
appCloudFunction = await import("../index");
});
after(() => {
adminInitStub.restore();
test.cleanup();
});
it("should always pass", function() {
const wrapped = test.wrap(appCloudFunction.app);
wrapped(null);
});
});
and my cloud function(index.ts) looks something like this
import * as functions from "firebase-functions";
import app from "./app/app";
exports.app = functions.https.onRequest(app);
here app is an simple express application.
Can anyone help me solve this problem?