Skip to content

Commit

Permalink
add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaliagg9791 committed Oct 5, 2023
1 parent c501162 commit f602a80
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions internal/store/elasticsearch/discovery_search_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,39 @@ func TestSearcherSearch(t *testing.T) {
{Type: "topic", AssetID: "transaction", Service: "rabbitmq", Data: map[string]interface{}{"company": "gotocompany", "description": "This publishes all the invoices from each of invoice storage where the invoice will be filtered and checked using invoice filterer and invoice checker", "environment": "production", "partition": float64(1), "topic_name": "transaction"}},
},
},
{
Description: "should fetch assets with empty text",
Config: asset.SearchConfig{
Text: "",
IncludeFields: []string{"id", "type"},
Filters: map[string][]string{"service": {"bigquery"}},
},
Expected: []expectedRow{
{Type: "table", AssetID: "bigquery::gcpproject/dataset/tablename-1"},
{Type: "table", AssetID: "bigquery::gcpproject/dataset/tablename-common"},
{Type: "table", AssetID: "bigquery::gcpproject/dataset/tablename-abc-common-test"},
{Type: "table", AssetID: "bigquery::gcpproject/dataset/tablename-mid"},
{Type: "table", AssetID: "bigquery::gcpproject/dataset/abc-tablename-mid"},
{Type: "table", AssetID: "bigquery::gcpproject/dataset/test"},
},
},
{
Description: "should fetch assets with empty text and rank by",
Config: asset.SearchConfig{
Text: "",
RankBy: "data.profile.usage_count",
IncludeFields: []string{"id", "type"},
Filters: map[string][]string{"service": {"bigquery"}},
},
Expected: []expectedRow{
{Type: "table", AssetID: "bigquery::gcpproject/dataset/tablename-common"},
{Type: "table", AssetID: "bigquery::gcpproject/dataset/tablename-mid"},
{Type: "table", AssetID: "bigquery::gcpproject/dataset/test"},
{Type: "table", AssetID: "bigquery::gcpproject/dataset/tablename-1"},
{Type: "table", AssetID: "bigquery::gcpproject/dataset/tablename-abc-common-test"},
{Type: "table", AssetID: "bigquery::gcpproject/dataset/abc-tablename-mid"},
},
},
{
Description: "should fetch assets which has text in any of its fields",
Config: asset.SearchConfig{
Expand Down

0 comments on commit f602a80

Please sign in to comment.