Skip to content

Commit 205726a

Browse files
imorspitfire55
authored andcommitted
add a test for aliases in aggregates
1 parent 3b3eb32 commit 205726a

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

test/expected/aggregate.out

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,4 +471,31 @@ begin;
471471
{"data": {"blogCollection": {"edges": [{"node": {"name": "A: Blog 1", "blogPostCollection": {"aggregate": {"count": 1}}}}, {"node": {"name": "A: Blog 2", "blogPostCollection": {"aggregate": {"count": 2}}}}, {"node": {"name": "A: Blog 3", "blogPostCollection": {"aggregate": {"count": 0}}}}, {"node": {"name": "B: Blog 3", "blogPostCollection": {"aggregate": {"count": 1}}}}]}}}
472472
(1 row)
473473

474+
-- Test Case 19: aliases test case
475+
select graphql.resolve($$
476+
query {
477+
blogCollection {
478+
agg: aggregate {
479+
cnt: count
480+
total: sum {
481+
identifier: id
482+
}
483+
average: avg {
484+
identifier: id
485+
}
486+
minimum: min {
487+
identifier: id
488+
}
489+
maximum: max {
490+
identifier: id
491+
}
492+
}
493+
}
494+
}
495+
$$);
496+
resolve
497+
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
498+
{"data": {"blogCollection": {"agg": {"cnt": 4, "total": {"identifier": 10}, "average": {"identifier": 2.5}, "maximum": {"identifier": 4}, "minimum": {"identifier": 1}}}}}
499+
(1 row)
500+
474501
rollback;

test/sql/aggregate.sql

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,4 +413,28 @@ begin;
413413
}
414414
$$);
415415

416+
417+
-- Test Case 19: aliases test case
418+
select graphql.resolve($$
419+
query {
420+
blogCollection {
421+
agg: aggregate {
422+
cnt: count
423+
total: sum {
424+
identifier: id
425+
}
426+
average: avg {
427+
identifier: id
428+
}
429+
minimum: min {
430+
identifier: id
431+
}
432+
maximum: max {
433+
identifier: id
434+
}
435+
}
436+
}
437+
}
438+
$$);
439+
416440
rollback;

0 commit comments

Comments
 (0)