Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Weakky committed Nov 16, 2023
1 parent eb4930a commit 303e84f
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ mod aggregation_group_by {
let schema = indoc! {
r#"model Test {
#id(id, Int, @id)
group Int
color Color
}
Expand All @@ -534,19 +535,19 @@ mod aggregation_group_by {
}

// regression test for https://github.com/prisma/prisma/issues/21789
#[connector_test(schema(schema_21789), capabilities(Enums))]
#[connector_test(schema(schema_21789), only(Postgres, CockroachDB))]
async fn regression_21789(runner: Runner) -> TestResult<()> {
run_query!(
&runner,
r#"mutation { createOneTest(data: { id: 1, color: "red" }) { id } }"#
r#"mutation { createOneTest(data: { id: 1, group: 1, color: "red" }) { id } }"#
);
run_query!(
&runner,
r#"mutation { createOneTest(data: { id: 2, color: "green" }) { id } }"#
r#"mutation { createOneTest(data: { id: 2, group: 2, color: "green" }) { id } }"#
);
run_query!(
&runner,
r#"mutation { createOneTest(data: { id: 3, color: "blue" }) { id } }"#
r#"mutation { createOneTest(data: { id: 3, group: 1, color: "blue" }) { id } }"#
);

insta::assert_snapshot!(
Expand All @@ -555,8 +556,8 @@ mod aggregation_group_by {
);

insta::assert_snapshot!(
run_query!(&runner, r#"{ groupByTest(by: [color]) { color _max { color } _min { color } } }"#),
@r###"{"data":{"groupByTest":[{"color":"green","_max":{"color":"green"},"_min":{"color":"green"}},{"color":"blue","_max":{"color":"blue"},"_min":{"color":"blue"}},{"color":"red","_max":{"color":"red"},"_min":{"color":"red"}}]}"###
run_query!(&runner, r#"{ groupByTest(by: [group], orderBy: { group: asc }) { group _max { color } _min { color } } }"#),
@r###"{"data":{"groupByTest":[{"group":1,"_max":{"color":"red"},"_min":{"color":"blue"}},{"group":2,"_max":{"color":"green"},"_min":{"color":"green"}}]}}"###
);

Ok(())
Expand Down

0 comments on commit 303e84f

Please sign in to comment.