-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c41b3a3
commit c87e727
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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") | ||
}) | ||
} |