Skip to content

Commit

Permalink
integrationTests/ts: Simplify extensions tests (#3289)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Oct 6, 2021
1 parent ae34b82 commit bfc354e
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions integrationTests/ts/extensions-test.ts
@@ -1,25 +1,15 @@
import { GraphQLString, GraphQLObjectType } from 'graphql/type';

interface SomeExtension {
number: number;
string: string;
meaningOfLife: 42;
}

const example: SomeExtension = {
number: 42,
string: 'Meaning of life',
};

declare module 'graphql' {
interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> {
interface GraphQLObjectTypeExtensions<_TSource, _TContext> {
someObjectExtension?: SomeExtension;
}

interface GraphQLFieldExtensions<
_TSource,
_TContext,
_TArgs = { [argName: string]: any },
> {
interface GraphQLFieldExtensions<_TSource, _TContext, _TArgs> {
someFieldExtension?: SomeExtension;
}

Expand All @@ -37,18 +27,18 @@ const queryType: GraphQLObjectType = new GraphQLObjectType({
who: {
type: GraphQLString,
extensions: {
someArgumentExtension: example,
someArgumentExtension: { meaningOfLife: 42 },
},
},
},
resolve: (_root, args) => 'Hello ' + (args.who || 'World'),
extensions: {
someFieldExtension: example,
someFieldExtension: { meaningOfLife: 42 },
},
},
}),
extensions: {
someObjectExtension: example,
someObjectExtension: { meaningOfLife: 42 },
},
});

Expand Down

0 comments on commit bfc354e

Please sign in to comment.