Skip to content

Commit

Permalink
Fix the filter type and name
Browse files Browse the repository at this point in the history
  • Loading branch information
george-harness committed Jun 8, 2021
1 parent 742715b commit 7597a1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/dom/parser/query.y
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ filter_list : filter

filter : FILTER IDENTIFIER AS classname ';'
{
$$ = dom.Filter{FieldType: $2, FieldName: $4, Operation: dom.EQUAL}
$$ = dom.Filter{FieldType: $4, FieldName: $2, Operation: dom.EQUAL}
}
| FILTER IDENTIFIER AS IDENTIFIER FROM LIST ';'
{
$$ = dom.Filter{FieldType: $2, FieldName: $4, Operation: dom.IN}
$$ = dom.Filter{FieldType: $4, FieldName: $2, Operation: dom.IN}
}
;

Expand Down
12 changes: 6 additions & 6 deletions src/dom/parser/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestSanityWithSingleFilter(t *testing.T) {
assert.Equal(t, dom.Query{Name: "DelegateTask",
Collection: "io.harness.beans.DelegateTasks",
Filters: []dom.Filter{
{FieldType: "accountId", FieldName: "string"},
{FieldType: "string", FieldName: "accountId"},
},
}, q)
}
Expand All @@ -33,8 +33,8 @@ func TestSanityWithMultipleFilters(t *testing.T) {
assert.Equal(t, dom.Query{Name: "DelegateTask",
Collection: "io.harness.beans.DelegateTasks",
Filters: []dom.Filter{
{FieldType: "accountId", FieldName: "string"},
{FieldType: "delegateId", FieldName: "int"},
{FieldType: "string", FieldName: "accountId"},
{FieldType: "int", FieldName: "delegateId"},
},
}, q)
}
Expand All @@ -48,8 +48,8 @@ func TestFiltersWithList(t *testing.T) {
assert.Equal(t, dom.Query{Name: "DelegateTask",
Collection: "io.harness.beans.DelegateTasks",
Filters: []dom.Filter{
{FieldType: "accountId", FieldName: "string", Operation: dom.IN},
{FieldType: "delegateId", FieldName: "int", Operation: dom.IN},
{FieldType: "string", FieldName: "accountId", Operation: dom.IN},
{FieldType: "int", FieldName: "delegateId", Operation: dom.IN},
},
}, q)
}
Expand All @@ -62,7 +62,7 @@ func TestFiltersWithFullPath(t *testing.T) {
assert.Equal(t, dom.Query{Name: "DelegateTask",
Collection: "io.harness.beans.DelegateTasks",
Filters: []dom.Filter{
{FieldType: "accountId", FieldName: "io.harness.beans.Id", Operation: dom.EQUAL},
{FieldType: "io.harness.beans.Id", FieldName: "accountId", Operation: dom.EQUAL},
},
}, q)
}

0 comments on commit 7597a1d

Please sign in to comment.