在我的单元测试中,我想断言调用了 workflow.Sleep()
。我该怎么做?
最佳答案
可以使用 TestWorkflowEnvironment.Now()
函数访问模拟时间。例如:
before := testenv.Now()
testenv.ExecuteWorkflow(...)
after := testenv.Now()
然后断言 before
和 after
之间的变化。
关于unit-testing - 优步 Cadence : How do I assert the call to workflow. sleep ()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55840614/