@@ -21,6 +21,31 @@ schema{
2121` ;
2222 const tree = Parser . parse ( schema ) ;
2323 const tdnResult = pluginTypedDocumentNode ( { tree } ) ;
24- expect ( tdnResult . ts ) . toContain ( `TODO` ) ;
24+ expect ( tdnResult . ts ) . toContain ( `
25+ import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
26+ import gql from 'graphql-tag';
27+ import { GraphQLTypes, InputType, ValueTypes, Zeus } from './index';
28+ ` ) ;
29+
30+ expect ( tdnResult . ts ) . toContain ( `export function tq<Z extends ValueTypes["Query"]>(
31+ query: Z | ValueTypes["Query"],
32+ ): TypedDocumentNode<InputType<GraphQLTypes["Query"], Z>, {}> {
33+ return gql(Zeus("query", query));
34+ }` ) ;
35+
36+ expect ( tdnResult . ts ) . toContain ( `
37+ export function tm<Z extends ValueTypes["Mutation"]>(
38+ mutation: Z | ValueTypes["Mutation"],
39+ ): TypedDocumentNode<InputType<GraphQLTypes["Mutation"], Z>, {}> {
40+ return gql(Zeus("mutation", mutation));
41+ }
42+ ` ) ;
43+ expect ( tdnResult . ts ) . toContain ( `
44+ export function ts<Z extends ValueTypes["Subscription"]>(
45+ subscription: Z | ValueTypes["Subscription"],
46+ ): TypedDocumentNode<InputType<GraphQLTypes["Subscription"], Z>, {}> {
47+ return gql(Zeus("subscription", subscription));
48+ }
49+ ` ) ;
2550 } ) ;
2651} ) ;
0 commit comments