P1x*_*ler 5 firebase google-cloud-functions
我写了一个像这里描述的预定函数:https : //firebase.google.com/docs/functions/schedule-functions
我现在如何测试这个功能?当我包装这个函数时(就像我对任何其他云函数一样),有一个错误说:“属性 'wrap' 在类型 'TestFunction' 上不存在。”
const functionWrapper = test.wrap(function);
Run Code Online (Sandbox Code Playgroud)
有没有其他方法可以测试这些功能?
小智 6
我发现的一种解决方法是将我的代码隔离在函数中并从计划函数中调用该函数。当我测试时,我没有调用预定函数,而是直接调用隔离函数。
前任:
export const dailyJob = functions.pubsub
.schedule('0 0 * * *')
.onRun(async context => {
return isolatedFunction();
})
export function isolatedFunction() {
...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
658 次 |
| 最近记录: |