Skip to content

Commit

Permalink
add fixture test for duplicated selections
Browse files Browse the repository at this point in the history
Reviewed By: captbaritone

Differential Revision: D52609668

fbshipit-source-id: f16061e29ef07b75378c6272cb3f57f5e005f823
  • Loading branch information
monicatang authored and facebook-github-bot committed Jan 9, 2024
1 parent 9f135b8 commit 2620736
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
==================================== INPUT ====================================
query clientInlineFragmentsDuplicateQuery {
cat {
description
description
... on Tabby {
greeting
}
... on Tabby {
greeting
}
}
}

# %extensions%
interface Cat {
description: String
}

type Tabby implements Cat {
description: String
greeting: String
}

extend type Query {
cat: Cat
}
==================================== OUTPUT ===================================
{
"fragment": {
"argumentDefinitions": [],
"kind": "Fragment",
"metadata": null,
"name": "clientInlineFragmentsDuplicateQuery",
"selections": [
{
"kind": "ClientExtension",
"selections": [
{
"alias": null,
"args": null,
"concreteType": null,
"kind": "LinkedField",
"name": "cat",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "description",
"storageKey": null
},
{
"kind": "InlineFragment",
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "greeting",
"storageKey": null
}
],
"type": "Tabby",
"abstractKey": null
}
],
"storageKey": null
}
]
}
],
"type": "Query",
"abstractKey": null
},
"kind": "Request",
"operation": {
"argumentDefinitions": [],
"kind": "Operation",
"name": "clientInlineFragmentsDuplicateQuery",
"selections": [
{
"kind": "ClientExtension",
"selections": [
{
"alias": null,
"args": null,
"concreteType": null,
"kind": "LinkedField",
"name": "cat",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "description",
"storageKey": null
},
{
"kind": "InlineFragment",
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "greeting",
"storageKey": null
}
],
"type": "Tabby",
"abstractKey": null
}
],
"storageKey": null
}
]
}
]
},
"params": {
"cacheID": "a22161d66129f4ea54b4be1a1b16caa8",
"id": null,
"metadata": {},
"name": "clientInlineFragmentsDuplicateQuery",
"operationKind": "query",
"text": null
}
}

QUERY:

Query Text is Empty.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
query clientInlineFragmentsDuplicateQuery {
cat {
description
description
... on Tabby {
greeting
}
... on Tabby {
greeting
}
}
}

# %extensions%
interface Cat {
description: String
}

type Tabby implements Cat {
description: String
greeting: String
}

extend type Query {
cat: Cat
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<67569a8907d69b96156dd8020479f37c>>
* @generated SignedSource<<8fd59e4b7bda332f7cd258dfa0d50257>>
*/

mod compile_relay_artifacts;
Expand Down Expand Up @@ -306,6 +306,13 @@ async fn client_inline_fragments() {
test_fixture(transform_fixture, file!(), "client-inline-fragments.graphql", "compile_relay_artifacts/fixtures/client-inline-fragments.expected", input, expected).await;
}

#[tokio::test]
async fn client_inline_fragments_duplicate() {
let input = include_str!("compile_relay_artifacts/fixtures/client-inline-fragments-duplicate.graphql");
let expected = include_str!("compile_relay_artifacts/fixtures/client-inline-fragments-duplicate.expected");
test_fixture(transform_fixture, file!(), "client-inline-fragments-duplicate.graphql", "compile_relay_artifacts/fixtures/client-inline-fragments-duplicate.expected", input, expected).await;
}

#[tokio::test]
async fn client_inline_fragments_in_query() {
let input = include_str!("compile_relay_artifacts/fixtures/client-inline-fragments-in-query.graphql");
Expand Down

0 comments on commit 2620736

Please sign in to comment.