diff --git a/model/project_test.go b/model/project_test.go index 0ab7d0c6a2..b5782a80d7 100644 --- a/model/project_test.go +++ b/model/project_test.go @@ -1371,7 +1371,10 @@ func (s *projectSuite) TestBuildProjectTVPairsWithDisplayTaskWithDependencies() s.Contains(vt.Tasks, "very_task") s.Require().Len(vt.DisplayTasks, 1) s.Equal("memes", vt.DisplayTasks[0].Name) - s.Empty(vt.DisplayTasks[0].ExecTasks) + s.Len(vt.DisplayTasks[0].ExecTasks, 3) + s.Contains(vt.DisplayTasks[0].ExecTasks, "9001_task") + s.Contains(vt.DisplayTasks[0].ExecTasks, "very_task") + s.Contains(vt.DisplayTasks[0].ExecTasks, "another_disabled_task") } else if vt.Variant == "bv_2" { s.Len(vt.Tasks, 1) s.Contains(vt.Tasks, "a_task_2") diff --git a/rest/model/patch_test.go b/rest/model/patch_test.go index bff4c23c6f..f8cd496781 100644 --- a/rest/model/patch_test.go +++ b/rest/model/patch_test.go @@ -2,7 +2,6 @@ package model import ( "context" - "fmt" "strings" "testing" "time" @@ -257,33 +256,14 @@ func TestPreselectedDisplayTasks(t *testing.T) { require.Len(t, a.VariantsTasks, 1) assert.Len(t, a.VariantsTasks[0].Tasks, 3) - foundTask1 := false - foundTask2 := false - foundExecTask1 := false - foundExecTask2 := false - foundDisplayTask := false - - for _, vt := range a.VariantsTasks { - for _, task := range vt.Tasks { - fmt.Println("Task:", utility.FromStringPtr(task)) - switch utility.FromStringPtr(task) { - case "variant_task_1": - foundTask1 = true - case "variant_task_2": - foundTask2 = true - case "display_task": - foundDisplayTask = true - case "exec1": - foundExecTask1 = true - case "exec2": - foundExecTask2 = true - } - } + tasks := []string{} + for _, task := range a.VariantsTasks[0].Tasks { + tasks = append(tasks, utility.FromStringPtr(task)) } - assert.True(t, foundTask1) - assert.True(t, foundTask2) - assert.False(t, foundExecTask1) - assert.False(t, foundExecTask2) - assert.True(t, foundDisplayTask) + assert.Contains(t, tasks, "variant_task_1") + assert.Contains(t, tasks, "variant_task_2") + assert.NotContains(t, tasks, "exec1") + assert.NotContains(t, tasks, "exec2") + assert.Contains(t, tasks, "display_task") }