Skip to content

Commit

Permalink
test multiple uses of relation with different fields
Browse files Browse the repository at this point in the history
  • Loading branch information
hallettj committed Jul 11, 2024
1 parent 85e2739 commit e1a58eb
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
25 changes: 25 additions & 0 deletions crates/integration-tests/src/tests/local_relationship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,28 @@ async fn sorts_by_field_of_related_collection() -> anyhow::Result<()> {
);
Ok(())
}

#[tokio::test]
async fn looks_up_the_same_relation_twice_with_different_fields() -> anyhow::Result<()> {
assert_yaml_snapshot!(
graphql_query(
r#"
{
artist(limit: 2, order_by: {id: Asc}) {
albums1: albums(order_by: {title: Asc}) {
title
}
albums2: albums(order_by: {title: Asc}) {
tracks(order_by: {name: Asc}) {
name
}
}
}
}
"#
)
.run()
.await?
);
Ok(())
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
source: crates/integration-tests/src/tests/local_relationship.rs
expression: "graphql_query(r#\"\n {\n artist(limit: 2, order_by: {id: Asc}) {\n albums1: albums(order_by: {title: Asc}) {\n title\n }\n albums2: albums {\n tracks(order_by: {name: Asc}) {\n name\n }\n }\n }\n }\n \"#).run().await?"
---
data:
artist:
- albums1:
- title: For Those About To Rock We Salute You
- title: Let There Be Rock
albums2:
- tracks:
- name: Breaking The Rules
- name: C.O.D.
- name: Evil Walks
- name: For Those About To Rock (We Salute You)
- name: Inject The Venom
- name: "Let's Get It Up"
- name: Night Of The Long Knives
- name: Put The Finger On You
- name: Snowballed
- name: Spellbound
- tracks:
- name: Bad Boy Boogie
- name: Dog Eat Dog
- name: Go Down
- name: "Hell Ain't A Bad Place To Be"
- name: Let There Be Rock
- name: Overdose
- name: Problem Child
- name: Whole Lotta Rosie
- albums1:
- title: The Best Of Buddy Guy - The Millenium Collection
albums2:
- tracks:
- name: First Time I Met The Blues
- name: Keep It To Myself (Aka Keep It To Yourself)
- name: Leave My Girl Alone
- name: Let Me Love You Baby
- name: My Time After Awhile
- name: Pretty Baby
- name: She Suits Me To A Tee
- name: Stone Crazy
- name: "Talkin' 'Bout Women Obviously"
- name: Too Many Ways (Alternate)
- name: When My Left Eye Jumps
errors: ~

0 comments on commit e1a58eb

Please sign in to comment.