Skip to content

Commit

Permalink
feat: Add additional test cases to QueryRoundtripGrammar tests
Browse files Browse the repository at this point in the history
  • Loading branch information
travisstebbins committed Feb 13, 2025
1 parent 77feff8 commit a5381f0
Showing 1 changed file with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ const TEST_CASES: QueryTestCase[] = [
queryGrammar:
"|showcase::northwind::model::crm::Customer.all()->filter(x|$x.companyTitle == 'company title')->project(~['Company Name':x|$x.companyName, 'Company Title':x|$x.companyTitle])->filter(row|$row.'Company Name' == 'company name')",
},
// result modifier
{
testName: '[LEGACY] Result Modifier: Sort',
model: 'Northwind',
Expand Down Expand Up @@ -153,21 +154,42 @@ const TEST_CASES: QueryTestCase[] = [
convertedRelation:
"|showcase::northwind::model::crm::Customer.all()->filter(x|$x.companyTitle == 'company title')->project(~['Company Name':x|$x.companyName, 'Company Title':x|$x.companyTitle])->filter(row|$row.'Company Name' == 'company name')",
},
//aggregation
// aggregation
{
testName: '[LEGACY AGGREGATION] Simple wavg query',
model: 'Northwind',
queryGrammar:
"|showcase::northwind::model::OrderLineItem.all()->groupBy([], [agg(x|$x.quantity->meta::pure::functions::math::wavgUtility::wavgRowMapper($x.unitPrice), y|$y->wavg())], ['Quantity (wavg)'])",
},
{
testName: '[AGGREGATION] Simple count query',
testName: '[LEGACY AGGREGATION] Simple group by count query',
model: 'Northwind',
queryGrammar:
"|showcase::northwind::model::Order.all()->groupBy([x|$x.shipToName], [agg(x|$x.id,x|$x->count())], ['Ship To Name','Id (count)'])",
convertedRelation:
"|showcase::northwind::model::Order.all()->project(~['Ship To Name':x|$x.shipToName, 'Id (count)':x|$x.id])->groupBy(~['Ship To Name'], ~['Id (count)':x|$x.'Id (count)':x|$x->count()])",
},
{
testName: '[AGGREGATION] Group by count query with nested property',
model: 'Northwind',
queryGrammar:
"|showcase::northwind::model::Order.all()->project(~['Ship To Name':x|$x.shipToName, 'Customer/Id (count)':x|$x.customer.id])->groupBy(~['Ship To Name'], ~['Customer/Id (count)':x|$x.'Customer/Id (count)':x|$x->count()])",
},
{
testName:
'[AGGREGATION] Group by count query with pre-filter and post-filter',
model: 'Northwind',
queryGrammar:
"|showcase::northwind::model::Order.all()->filter(x|$x.shipToName == 'test')->project(~['Ship To Name':x|$x.shipToName, 'Id (count)':x|$x.id])->groupBy(~['Ship To Name'], ~['Id (count)':x|$x.'Id (count)':x|$x->count()])->filter(row|$row.'Id (count)' >= 5)",
},
{
testName:
'[AGGREGATION] Group by count query with post-filter before groupBy',
model: 'Northwind',
queryGrammar:
"|showcase::northwind::model::Order.all()->project(~['Ship To Name':x|$x.shipToName, 'Id (count)':x|$x.id])->filter(row|$row.'Id (count)' >= 5)->groupBy(~['Ship To Name'], ~['Id (count)':x|$x.'Id (count)':x|$x->count()])",
isUnsupported: true,
},
];

const globalGraphManagerStates = new Map<string, GraphManagerState>();
Expand Down

0 comments on commit a5381f0

Please sign in to comment.