Skip to content

Commit

Permalink
👻 add more tests
Browse files Browse the repository at this point in the history
Signed-off-by: Pranav Gaikwad <[email protected]>
  • Loading branch information
pranavgaikwad committed Sep 27, 2023
1 parent 3f70841 commit 3cd80e4
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion engine/labels/labels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ func Test_getBooleanExpression(t *testing.T) {
},
want: "( true || true ) && false && true",
},
{
name: "values with version ranges",
expr: "(konveyor.io/target=Spring Beans12 && konveyor.io/target=hibernate6.1)",
compareLabels: map[string][]string{
"konveyor.io/target": {"hibernate6-", "Spring Beans11+"},
},
want: "( true && false )",
},
{
name: "values with version ranges",
expr: "(konveyor.io/target=Spring Beans12 && konveyor.io/target=hibernate6.1)",
compareLabels: map[string][]string{
"konveyor.io/target": {"hibernate6+", "Spring Beans11-"},
},
want: "( false && true )",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down Expand Up @@ -160,11 +176,23 @@ func TestParseLabel(t *testing.T) {
wantVal: "Spring Beans",
},
{
name: "version ranges in values",
name: "absolte version in value",
label: "konveyor.io/fact=Spring Beans12",
wantKey: "konveyor.io/fact",
wantVal: "Spring Beans12",
},
{
name: "version range + in value",
label: "konveyor.io/fact=Spring Beans12+",
wantKey: "konveyor.io/fact",
wantVal: "Spring Beans12+",
},
{
name: "version range - in value",
label: "konveyor.io/fact=Spring Beans12-",
wantKey: "konveyor.io/fact",
wantVal: "Spring Beans12-",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 3cd80e4

Please sign in to comment.