Skip to content

Commit

Permalink
Add 2 JS snapshot tests to SkipRedundantNodesTransform
Browse files Browse the repository at this point in the history
Reviewed By: jstejada

Differential Revision: D20285547

fbshipit-source-id: 8d1e52432c9407691812376aa781455bc4a92741
  • Loading branch information
tyao1 authored and facebook-github-bot committed Mar 6, 2020
1 parent 24180d7 commit 9883c81
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,43 @@ query DontSkipNestedFieldsAcrossFragments {
`;

exports[`SkipRedundantNodesTransform matches expected output: dont-skip-with-inline-on-diffent-types.graphql 1`] = `
~~~~~~~~~~ INPUT ~~~~~~~~~~
query DontSkipWithInlineFragmentOnDifferentTypes {
viewer {
actor {
... on Actor {
id
}
... on User {
id # we currently don't skip this
hometown {
name
}
}
}
}
}
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
query DontSkipWithInlineFragmentOnDifferentTypes {
viewer {
actor {
... on Actor {
id
}
... on User {
id
hometown {
name
}
}
}
}
}
`;

exports[`SkipRedundantNodesTransform matches expected output: skip-nested-linked-fields.graphql 1`] = `
~~~~~~~~~~ INPUT ~~~~~~~~~~
query SkipNestedLinkedFields {
Expand Down Expand Up @@ -148,6 +185,48 @@ query SkipNestedFields {
`;

exports[`SkipRedundantNodesTransform matches expected output: skips-with-client-extensions.graphql 1`] = `
~~~~~~~~~~ INPUT ~~~~~~~~~~
query SkipWithClientExtensions {
viewer {
actor {
... on Actor {
clientName
clientUser {
name
}
clientName
clientUser {
... on User {
name
}
}
}
}
}
}
extend interface Actor {
clientName: String
clientUser: User
}
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
query SkipWithClientExtensions {
viewer {
actor {
... on Actor {
clientName
clientUser {
name
}
}
}
}
}
`;

exports[`SkipRedundantNodesTransform matches expected output: skips-with-fragment.graphql 1`] = `
~~~~~~~~~~ INPUT ~~~~~~~~~~
fragment ProfilePicture on User {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
query DontSkipWithInlineFragmentOnDifferentTypes {
viewer {
actor {
... on Actor {
id
}
... on User {
id # we currently don't skip this
hometown {
name
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
query SkipWithClientExtensions {
viewer {
actor {
... on Actor {
clientName
clientUser {
name
}
clientName
clientUser {
... on User {
name
}
}
}
}
}
}

extend interface Actor {
clientName: String
clientUser: User
}

0 comments on commit 9883c81

Please sign in to comment.