-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for @refetchable with FetchableType and Node interface
Reviewed By: tyao1 Differential Revision: D58056841 fbshipit-source-id: 2ebf83695d28cf7a1908d3d43182abcb0ad6ff97
- Loading branch information
1 parent
6955ce6
commit 60f7009
Showing
6 changed files
with
344 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
...pile_relay_artifacts/fixtures/refetchable-fragment-on-node-and-fetchable-no-flag.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
==================================== INPUT ==================================== | ||
fragment refetchableFragmentOnNodeAndFetchableNoFlag_RefetchableFragment on FetchableType | ||
@refetchable(queryName: "RefetchableFragmentQuery") { | ||
id | ||
} | ||
==================================== OUTPUT =================================== | ||
{ | ||
"fragment": { | ||
"argumentDefinitions": [ | ||
{ | ||
"defaultValue": null, | ||
"kind": "LocalArgument", | ||
"name": "id" | ||
} | ||
], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "RefetchableFragmentQuery", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": [ | ||
{ | ||
"kind": "Variable", | ||
"name": "id", | ||
"variableName": "id" | ||
} | ||
], | ||
"concreteType": null, | ||
"kind": "LinkedField", | ||
"name": "node", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"args": null, | ||
"kind": "FragmentSpread", | ||
"name": "refetchableFragmentOnNodeAndFetchableNoFlag_RefetchableFragment" | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
], | ||
"type": "Query", | ||
"abstractKey": null | ||
}, | ||
"kind": "Request", | ||
"operation": { | ||
"argumentDefinitions": [ | ||
{ | ||
"defaultValue": null, | ||
"kind": "LocalArgument", | ||
"name": "id" | ||
} | ||
], | ||
"kind": "Operation", | ||
"name": "RefetchableFragmentQuery", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": [ | ||
{ | ||
"kind": "Variable", | ||
"name": "id", | ||
"variableName": "id" | ||
} | ||
], | ||
"concreteType": null, | ||
"kind": "LinkedField", | ||
"name": "node", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "__typename", | ||
"storageKey": null | ||
}, | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "id", | ||
"storageKey": null | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
] | ||
}, | ||
"params": { | ||
"cacheID": "31dcd57f42128b8d975e6224202a17c9", | ||
"id": null, | ||
"metadata": {}, | ||
"name": "RefetchableFragmentQuery", | ||
"operationKind": "query", | ||
"text": null | ||
} | ||
} | ||
|
||
QUERY: | ||
|
||
query RefetchableFragmentQuery( | ||
$id: ID! | ||
) { | ||
node(id: $id) { | ||
__typename | ||
...refetchableFragmentOnNodeAndFetchableNoFlag_RefetchableFragment | ||
id | ||
} | ||
} | ||
|
||
fragment refetchableFragmentOnNodeAndFetchableNoFlag_RefetchableFragment on FetchableType { | ||
id | ||
} | ||
|
||
|
||
{ | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": { | ||
"refetch": { | ||
"connection": null, | ||
"fragmentPathInResult": [ | ||
"node" | ||
], | ||
"operation": require('RefetchableFragmentQuery.graphql'), | ||
"identifierInfo": { | ||
"identifierField": "id", | ||
"identifierQueryVariableName": "id" | ||
} | ||
} | ||
}, | ||
"name": "refetchableFragmentOnNodeAndFetchableNoFlag_RefetchableFragment", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "id", | ||
"storageKey": null | ||
} | ||
], | ||
"type": "FetchableType", | ||
"abstractKey": null | ||
} |
4 changes: 4 additions & 0 deletions
4
...mpile_relay_artifacts/fixtures/refetchable-fragment-on-node-and-fetchable-no-flag.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
fragment refetchableFragmentOnNodeAndFetchableNoFlag_RefetchableFragment on FetchableType | ||
@refetchable(queryName: "RefetchableFragmentQuery") { | ||
id | ||
} |
170 changes: 170 additions & 0 deletions
170
...ests/compile_relay_artifacts/fixtures/refetchable-fragment-on-node-and-fetchable.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
==================================== INPUT ==================================== | ||
# prefer_fetchable_in_refetch_queries | ||
|
||
fragment refetchableFragmentOnNodeAndFetchable_RefetchableFragment on FetchableType | ||
@refetchable(queryName: "RefetchableFragmentQuery") { | ||
id | ||
} | ||
==================================== OUTPUT =================================== | ||
{ | ||
"fragment": { | ||
"argumentDefinitions": [ | ||
{ | ||
"defaultValue": null, | ||
"kind": "LocalArgument", | ||
"name": "id" | ||
} | ||
], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "RefetchableFragmentQuery", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": [ | ||
{ | ||
"kind": "Variable", | ||
"name": "fetch_id", | ||
"variableName": "id" | ||
} | ||
], | ||
"concreteType": "FetchableType", | ||
"kind": "LinkedField", | ||
"name": "fetch__FetchableType", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"args": null, | ||
"kind": "FragmentSpread", | ||
"name": "refetchableFragmentOnNodeAndFetchable_RefetchableFragment" | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
], | ||
"type": "Query", | ||
"abstractKey": null | ||
}, | ||
"kind": "Request", | ||
"operation": { | ||
"argumentDefinitions": [ | ||
{ | ||
"defaultValue": null, | ||
"kind": "LocalArgument", | ||
"name": "id" | ||
} | ||
], | ||
"kind": "Operation", | ||
"name": "RefetchableFragmentQuery", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": [ | ||
{ | ||
"kind": "Variable", | ||
"name": "fetch_id", | ||
"variableName": "id" | ||
} | ||
], | ||
"concreteType": "FetchableType", | ||
"kind": "LinkedField", | ||
"name": "fetch__FetchableType", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "id", | ||
"storageKey": null | ||
}, | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "fetch_id", | ||
"storageKey": null | ||
}, | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "__token", | ||
"storageKey": null | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
] | ||
}, | ||
"params": { | ||
"cacheID": "31dcd57f42128b8d975e6224202a17c9", | ||
"id": null, | ||
"metadata": {}, | ||
"name": "RefetchableFragmentQuery", | ||
"operationKind": "query", | ||
"text": null | ||
} | ||
} | ||
|
||
QUERY: | ||
|
||
query RefetchableFragmentQuery( | ||
$id: ID! | ||
) { | ||
fetch__FetchableType(fetch_id: $id) { | ||
...refetchableFragmentOnNodeAndFetchable_RefetchableFragment | ||
id | ||
} | ||
} | ||
|
||
fragment refetchableFragmentOnNodeAndFetchable_RefetchableFragment on FetchableType { | ||
id | ||
fetch_id | ||
__token | ||
} | ||
|
||
|
||
{ | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": { | ||
"refetch": { | ||
"connection": null, | ||
"fragmentPathInResult": [ | ||
"fetch__FetchableType" | ||
], | ||
"operation": require('RefetchableFragmentQuery.graphql'), | ||
"identifierInfo": { | ||
"identifierField": "fetch_id", | ||
"identifierQueryVariableName": "id" | ||
} | ||
} | ||
}, | ||
"name": "refetchableFragmentOnNodeAndFetchable_RefetchableFragment", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "id", | ||
"storageKey": null | ||
}, | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "fetch_id", | ||
"storageKey": null | ||
}, | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "__token", | ||
"storageKey": null | ||
} | ||
], | ||
"type": "FetchableType", | ||
"abstractKey": null | ||
} |
6 changes: 6 additions & 0 deletions
6
...tests/compile_relay_artifacts/fixtures/refetchable-fragment-on-node-and-fetchable.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# prefer_fetchable_in_refetch_queries | ||
|
||
fragment refetchableFragmentOnNodeAndFetchable_RefetchableFragment on FetchableType | ||
@refetchable(queryName: "RefetchableFragmentQuery") { | ||
id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters