forked from temporalio/samples-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
workflow_test.go
31 lines (24 loc) · 982 Bytes
/
workflow_test.go
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
package worker_specific_task_queues
import (
"testing"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"go.temporal.io/sdk/activity"
"go.temporal.io/sdk/testsuite"
)
func Test_Workflow(t *testing.T) {
testSuite := &testsuite.WorkflowTestSuite{}
env := testSuite.NewTestWorkflowEnvironment()
// Mock activity implementation
var a WorkerSpecificTaskQueue
env.RegisterActivityWithOptions(a.GetWorkerSpecificTaskQueue, activity.RegisterOptions{
Name: "GetWorkerSpecificTaskQueue",
})
env.OnActivity("GetWorkerSpecificTaskQueue", mock.Anything).Return("unique-task-queue", nil)
env.OnActivity(DownloadFile, mock.Anything, mock.Anything, mock.Anything).Return(nil)
env.OnActivity(ProcessFile, mock.Anything, mock.Anything).Return(nil)
env.OnActivity(DeleteFile, mock.Anything, mock.Anything).Return(nil)
env.ExecuteWorkflow(FileProcessingWorkflow)
require.True(t, env.IsWorkflowCompleted())
require.NoError(t, env.GetWorkflowError())
}