-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathworkflow_test.go
More file actions
35 lines (29 loc) · 1.02 KB
/
workflow_test.go
File metadata and controls
35 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"testing"
"github.com/stretchr/testify/assert"
"go.uber.org/cadence/activity"
"go.uber.org/cadence/testsuite"
)
func TestDynamicWorkflow(t *testing.T) {
a := assert.New(t)
s := testsuite.WorkflowTestSuite{}
env := s.NewTestWorkflowEnvironment()
env.RegisterWorkflow(sampleGreetingsWorkflow)
env.RegisterActivityWithOptions(getGreetingActivity, activity.RegisterOptions{
Name: getGreetingActivityName,
})
env.RegisterActivityWithOptions(getNameActivity, activity.RegisterOptions{
Name: getNameActivityName,
})
env.RegisterActivityWithOptions(sayGreetingActivity, activity.RegisterOptions{
Name: sayGreetingActivityName,
})
env.OnActivity(getGreetingActivityName).Return("Greet", nil).Times(1)
env.OnActivity(getNameActivityName).Return("Name", nil).Times(1)
env.OnActivity(sayGreetingActivityName, "Greet", "Name").Return("Greet Name", nil).Times(1)
env.ExecuteWorkflow(sampleGreetingsWorkflow)
a.True(env.IsWorkflowCompleted())
a.NoError(env.GetWorkflowError())
env.AssertExpectations(t)
}