Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
eddeee888 committed Feb 26, 2023
1 parent 565f12c commit a65e065
Showing 1 changed file with 41 additions and 43 deletions.
84 changes: 41 additions & 43 deletions packages/plugins/typescript/resolvers/tests/ts-resolvers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1430,22 +1430,22 @@ export type ResolverFn<TResult, TParent, TContext, TArgs> = (
const content = await plugin(testSchema, [], {}, { outputFile: 'graphql.ts' });

expect(tsContent.content).toBeSimilarStringTo(`
export type CccFoo = {
__typename?: 'CCCFoo';
foo: Scalars['String'];
};
export type CccFoo = {
__typename?: 'CCCFoo';
foo: Scalars['String'];
};
`);
expect(tsContent.content).toBeSimilarStringTo(`
export type CccBar = {
__typename?: 'CCCBar';
bar: Scalars['String'];
};
export type CccBar = {
__typename?: 'CCCBar';
bar: Scalars['String'];
};
`);

expect(content.content).toBeSimilarStringTo(`
export type ResolversUnionTypes = {
CCCUnion: ( CccFoo ) | ( CccBar );
}
export type ResolversUnionTypes = {
CCCUnion: ( CccFoo ) | ( CccBar );
};
`);
expect(content.content).toBeSimilarStringTo(`
/** Mapping between all available schema types and the resolvers types */
Expand Down Expand Up @@ -1784,44 +1784,42 @@ export type ResolverFn<TResult, TParent, TContext, TArgs> = (
const content = await plugin(testSchema, [], {}, { outputFile: 'graphql.ts' });

expect(content.content).toBeSimilarStringTo(`
export type ResolversUnionTypes = {
UserPayload: ( UserResult ) | ( StandardError );
PostsPayload: ( PostsResult ) | ( StandardError );
};
export type ResolversUnionTypes = {
UserPayload: ( UserResult ) | ( StandardError );
PostsPayload: ( PostsResult ) | ( StandardError );
};
`);

expect(content.content).toBeSimilarStringTo(`
/** Mapping between all available schema types and the resolvers types */
export type ResolversTypes = {
Query: ResolverTypeWrapper<{}>;
ID: ResolverTypeWrapper<Scalars['ID']>;
StandardError: ResolverTypeWrapper<StandardError>;
String: ResolverTypeWrapper<Scalars['String']>;
User: ResolverTypeWrapper<User>;
UserResult: ResolverTypeWrapper<UserResult>;
UserPayload: ResolverTypeWrapper<ResolversUnionTypes['UserPayload']>;
Post: ResolverTypeWrapper<Post>;
PostsResult: ResolverTypeWrapper<PostsResult>;
PostsPayload: ResolverTypeWrapper<ResolversUnionTypes['PostsPayload']>;
Boolean: ResolverTypeWrapper<Scalars['Boolean']>;
};
export type ResolversTypes = {
Query: ResolverTypeWrapper<{}>;
ID: ResolverTypeWrapper<Scalars['ID']>;
StandardError: ResolverTypeWrapper<StandardError>;
String: ResolverTypeWrapper<Scalars['String']>;
User: ResolverTypeWrapper<User>;
UserResult: ResolverTypeWrapper<UserResult>;
UserPayload: ResolverTypeWrapper<ResolversUnionTypes['UserPayload']>;
Post: ResolverTypeWrapper<Post>;
PostsResult: ResolverTypeWrapper<PostsResult>;
PostsPayload: ResolverTypeWrapper<ResolversUnionTypes['PostsPayload']>;
Boolean: ResolverTypeWrapper<Scalars['Boolean']>;
};
`);

expect(content.content).toBeSimilarStringTo(`
/** Mapping between all available schema types and the resolvers parents */
export type ResolversParentTypes = {
Query: {};
ID: Scalars['ID'];
StandardError: StandardError;
String: Scalars['String'];
User: User;
UserResult: UserResult;
UserPayload: ResolversUnionTypes['UserPayload'];
Post: Post;
PostsResult: PostsResult;
PostsPayload: ResolversUnionTypes['PostsPayload'];
Boolean: Scalars['Boolean'];
};
export type ResolversParentTypes = {
Query: {};
ID: Scalars['ID'];
StandardError: StandardError;
String: Scalars['String'];
User: User;
UserResult: UserResult;
UserPayload: ResolversUnionTypes['UserPayload'];
Post: Post;
PostsResult: PostsResult;
PostsPayload: ResolversUnionTypes['PostsPayload'];
Boolean: Scalars['Boolean'];
};
`);
});

Expand Down

0 comments on commit a65e065

Please sign in to comment.