Skip to content

Commit

Permalink
add tests for makeFragmentData
Browse files Browse the repository at this point in the history
  • Loading branch information
tnyo43 committed Oct 15, 2023
1 parent 7fe808b commit ddb461c
Show file tree
Hide file tree
Showing 4 changed files with 655 additions and 6 deletions.
47 changes: 47 additions & 0 deletions dev-test/gql-tag-operations-masking/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ const documents = {
'\n fragment TweetsFragment on Query {\n Tweets {\n id\n ...TweetFragment\n ...TweetStatsFragment\n }\n }\n':
types.TweetsFragmentFragmentDoc,
'\n query TweetAppQuery {\n ...TweetsFragment\n }\n': types.TweetAppQueryDocument,
'\n fragment UserFragment on User {\n id\n username\n }\n': types.UserFragmentFragmentDoc,
'\n fragment TweetWithUserFragment on Tweet {\n id\n body\n author {\n ...UserFragment\n }\n }\n':
types.TweetWithUserFragmentFragmentDoc,
'\n fragment UserWithNameFragment on User {\n id\n username\n first_name\n last_name\n }\n':
types.UserWithNameFragmentFragmentDoc,
'\n fragment TweetWithUserNameFragment on Tweet {\n id\n body\n author {\n ...UserFragment\n ...UserWithNameFragment\n }\n }\n':
types.TweetWithUserNameFragmentFragmentDoc,
'\n fragment UserWithNestedFollowersAndTweetsFragment on User {\n id\n ...UserFragment\n ...UserWithNameFragment\n full_name\n Followers {\n id\n ...UserFragment\n Followers {\n id\n ...UserFragment\n }\n Tweets {\n ...TweetWithUserFragment\n }\n }\n Tweets {\n id\n ...TweetWithUserFragment\n author {\n id\n Followers {\n id\n ...UserFragment\n }\n }\n }\n }\n':
types.UserWithNestedFollowersAndTweetsFragmentFragmentDoc,
'\n fragment QueryOfNotificationsFragment on Query {\n Notifications {\n id\n\n ... on Message {\n body\n from {\n id\n }\n }\n ... on Information {\n body\n priority\n }\n }\n }\n':
types.QueryOfNotificationsFragmentFragmentDoc,
};

/**
Expand Down Expand Up @@ -68,6 +79,42 @@ export function graphql(
export function graphql(
source: '\n query TweetAppQuery {\n ...TweetsFragment\n }\n'
): (typeof documents)['\n query TweetAppQuery {\n ...TweetsFragment\n }\n'];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(
source: '\n fragment UserFragment on User {\n id\n username\n }\n'
): (typeof documents)['\n fragment UserFragment on User {\n id\n username\n }\n'];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(
source: '\n fragment TweetWithUserFragment on Tweet {\n id\n body\n author {\n ...UserFragment\n }\n }\n'
): (typeof documents)['\n fragment TweetWithUserFragment on Tweet {\n id\n body\n author {\n ...UserFragment\n }\n }\n'];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(
source: '\n fragment UserWithNameFragment on User {\n id\n username\n first_name\n last_name\n }\n'
): (typeof documents)['\n fragment UserWithNameFragment on User {\n id\n username\n first_name\n last_name\n }\n'];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(
source: '\n fragment TweetWithUserNameFragment on Tweet {\n id\n body\n author {\n ...UserFragment\n ...UserWithNameFragment\n }\n }\n'
): (typeof documents)['\n fragment TweetWithUserNameFragment on Tweet {\n id\n body\n author {\n ...UserFragment\n ...UserWithNameFragment\n }\n }\n'];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(
source: '\n fragment UserWithNestedFollowersAndTweetsFragment on User {\n id\n ...UserFragment\n ...UserWithNameFragment\n full_name\n Followers {\n id\n ...UserFragment\n Followers {\n id\n ...UserFragment\n }\n Tweets {\n ...TweetWithUserFragment\n }\n }\n Tweets {\n id\n ...TweetWithUserFragment\n author {\n id\n Followers {\n id\n ...UserFragment\n }\n }\n }\n }\n'
): (typeof documents)['\n fragment UserWithNestedFollowersAndTweetsFragment on User {\n id\n ...UserFragment\n ...UserWithNameFragment\n full_name\n Followers {\n id\n ...UserFragment\n Followers {\n id\n ...UserFragment\n }\n Tweets {\n ...TweetWithUserFragment\n }\n }\n Tweets {\n id\n ...TweetWithUserFragment\n author {\n id\n Followers {\n id\n ...UserFragment\n }\n }\n }\n }\n'];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(
source: '\n fragment QueryOfNotificationsFragment on Query {\n Notifications {\n id\n\n ... on Message {\n body\n from {\n id\n }\n }\n ... on Information {\n body\n priority\n }\n }\n }\n'
): (typeof documents)['\n fragment QueryOfNotificationsFragment on Query {\n Notifications {\n id\n\n ... on Message {\n body\n from {\n id\n }\n }\n ... on Information {\n body\n priority\n }\n }\n }\n'];

export function graphql(source: string) {
return (documents as any)[source] ?? {};
Expand Down
Loading

0 comments on commit ddb461c

Please sign in to comment.