Search code examples
unit-testinggocadence-workflow

Uber Cadence: How do I assert the call to workflow.Sleep()?


In my unit tests, I want to assert that workflow.Sleep() was called. How do I do this?


Solution

  • It's possible to access the emulated time using the TestWorkflowEnvironment.Now() function. For example:

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

    Then assert on the change between before and after.