-
Notifications
You must be signed in to change notification settings - Fork 8
/
filter_test.go
29 lines (23 loc) · 1.06 KB
/
filter_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
package workflow_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/luno/workflow"
)
func TestMakeFilter(t *testing.T) {
t.Run("Filter by RunState", func(t *testing.T) {
filter := workflow.MakeFilter(workflow.FilterByRunState(workflow.RunStateInitiated))
require.True(t, filter.ByRunState().Enabled, "Expected RunState filter to be enabled")
require.Equal(t, "1", filter.ByRunState().Value, "Expected RunState filter value to be 5")
})
t.Run("Filter by ForeignID", func(t *testing.T) {
filter := workflow.MakeFilter(workflow.FilterByForeignID("test value"))
require.True(t, filter.ByForeignID().Enabled, "Expected foreign ID filter to be enabled")
require.Equal(t, "test value", filter.ByForeignID().Value, "Expected foreign ID filter value to be 5")
})
t.Run("Filter by Status", func(t *testing.T) {
filter := workflow.MakeFilter(workflow.FilterByStatus(9))
require.True(t, filter.ByStatus().Enabled, "Expected status filter to be enabled")
require.Equal(t, "9", filter.ByStatus().Value, "Expected status filter value to be 5")
})
}