【问题标题】:Uber Cadence: How do I assert the call to workflow.Sleep()?Uber Cadence:如何断言对 workflow.Sleep() 的调用?
【发布时间】:2019-06-01 00:06:23
【问题描述】:

在我的单元测试中,我想断言 workflow.Sleep() 被调用。我该怎么做?

【问题讨论】:

    标签: unit-testing go cadence-workflow


    【解决方案1】:

    可以使用TestWorkflowEnvironment.Now() 函数访问模拟时间。例如:

    before := testenv.Now()
    testenv.ExecuteWorkflow(...)
    after := testenv.Now()
    

    然后断言beforeafter 之间的变化。

    【讨论】:

      猜你喜欢
      • 2021-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多