小编Klo*_*Klo的帖子

启用 App Check 的情况下对可调用 firebase 函数进行单元测试

我正在尝试根据提供的示例对我的 firebase 可调用云函数进行单元测试。请参阅Firebase 示例。归结起来是这样的

const { expect } = require("chai");
const admin = require("firebase-admin");

const test = require("firebase-functions-test")({
    projectId: "MYPROJECTID",
});

// Import the exported function definitions from our functions/index.js file
const myFunctions = require("../lib/test");
describe("Unit tests", () => {
  
  after(() => {
    test.cleanup();
  });

  it("tests a simple callable function", async () => {
    const wrapped = test.wrap(myFunctions.sayHelloWorld);

    const data = {
      eventName: "New event"
    };

    // Call the wrapped function with data and context
    const result = …
Run Code Online (Sandbox Code Playgroud)

unit-testing node.js firebase google-cloud-functions firebase-app-check

3
推荐指数
1
解决办法
667
查看次数