Skip to content

Commit

Permalink
refac(SFS-1439): solve duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
biancasilvavtex committed Sep 13, 2024
1 parent cd4cc7f commit 0a86127
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions custom_cel/lists_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,7 @@ func Test_sort(t *testing.T) {
},
}

for description, tc := range testCases {
t.Run(description, func(t *testing.T) {
prg := setupProgram(t, varName, tc.condition)

gotList, _, gotErr := prg.Eval(map[string]interface{}{
varName: tc.list,
})

if gotErr != nil {
t.Fatalf("eval error: %s", gotErr)
}

if gotList.Equal(tc.wantList) != types.True {
t.Errorf("\ngot=%v\nwant=%v", gotList, tc.wantList)
}
})
}
evaluateTestCases(t, testCases)
}

func Test_reverse(t *testing.T) {
Expand Down Expand Up @@ -170,6 +154,14 @@ func Test_reverse(t *testing.T) {
},
}

evaluateTestCases(t, testCases)
}

func evaluateTestCases(t *testing.T, testCases map[string]struct {
condition string
list any
wantList ref.Val
}) {
for description, tc := range testCases {
t.Run(description, func(t *testing.T) {
prg := setupProgram(t, varName, tc.condition)
Expand Down

0 comments on commit 0a86127

Please sign in to comment.