-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathworkflow_test.go
More file actions
50 lines (40 loc) · 1.13 KB
/
workflow_test.go
File metadata and controls
50 lines (40 loc) · 1.13 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package app_test
import (
"sync"
"testing"
"github.com/stackup-app/stackup/lib/app"
"github.com/stackup-app/stackup/lib/gateway"
"github.com/stretchr/testify/assert"
)
func TestCreateWorkflow(t *testing.T) {
gw := &gateway.Gateway{} // Mock or initialize as needed
processMap := &sync.Map{}
workflow := app.CreateWorkflow(gw, processMap)
assert.NotNil(t, workflow)
assert.NotNil(t, workflow.Settings)
assert.NotNil(t, workflow.Preconditions)
assert.NotNil(t, workflow.Tasks)
assert.NotNil(t, workflow.Includes)
assert.NotNil(t, workflow.Gateway)
assert.NotNil(t, workflow.ProcessMap)
assert.NotNil(t, workflow.Integrations)
}
func TestAsContract(t *testing.T) {
workflow := &app.StackupWorkflow{}
contract := workflow.AsContract()
assert.NotNil(t, contract)
}
func TestFindTaskById(t *testing.T) {
workflow := &app.StackupWorkflow{
Tasks: []*app.Task{
{Id: "test1"},
{Id: "test2"},
},
}
taskAny, found := workflow.FindTaskById("test1")
var task *app.Task = taskAny.(*app.Task)
assert.True(t, found)
assert.Equal(t, "test1", task.Id)
_, notFound := workflow.FindTaskById("test3")
assert.False(t, notFound)
}