-
Notifications
You must be signed in to change notification settings - Fork 0
/
workflow_suit_test.go
58 lines (49 loc) · 1.24 KB
/
workflow_suit_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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package workflow_test
import (
"context"
"testing"
"github.com/chein-huang/workflow"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestWorkFlow(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "WorkFlow Suite")
}
type TestStruct struct {
workBegin workflow.Event
workBeforeCommit workflow.Event
workCommit workflow.Event
workRollback workflow.Event
workFinish workflow.Event
}
func (s *TestStruct) WorkBegin(ctx context.Context, data *workflow.WorkData) error {
if s.workBegin != nil {
return s.workBegin(ctx, data)
}
return nil
}
func (s *TestStruct) WorkBeforeCommit(ctx context.Context, data *workflow.WorkData) error {
if s.workBeforeCommit != nil {
return s.workBeforeCommit(ctx, data)
}
return nil
}
func (s *TestStruct) WorkCommit(ctx context.Context, data *workflow.WorkData) error {
if s.workCommit != nil {
return s.workCommit(ctx, data)
}
return nil
}
func (s *TestStruct) WorkRollback(ctx context.Context, data *workflow.WorkData) error {
if s.workRollback != nil {
return s.workRollback(ctx, data)
}
return nil
}
func (s *TestStruct) WorkFinish(ctx context.Context, data *workflow.WorkData) error {
if s.workFinish != nil {
return s.workFinish(ctx, data)
}
return nil
}