Skip to content

Commit

Permalink
fix: clean up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ZackarySantana committed Dec 2, 2024
1 parent 9a333a3 commit 6753bbc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 29 deletions.
5 changes: 4 additions & 1 deletion model/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
36 changes: 8 additions & 28 deletions rest/model/patch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package model

import (
"context"
"fmt"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -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")
}

0 comments on commit 6753bbc

Please sign in to comment.