apollo-server-testing
Version:
Test utils for apollo-server
26 lines • 1.09 kB
TypeScript
import { ApolloServerBase } from 'apollo-server-core';
import { GraphQLResponse as GraphQLResponseType } from 'apollo-server-types';
import { DocumentNode } from 'graphql';
declare type StringOrAst = string | DocumentNode;
declare type Query<TVariables = Record<string, any>> = {
query: StringOrAst;
mutation?: undefined;
variables?: TVariables;
operationName?: string;
};
declare type Mutation<TVariables = Record<string, any>> = {
mutation: StringOrAst;
query?: undefined;
variables?: TVariables;
operationName?: string;
};
declare type GraphQLResponse<TData> = Omit<GraphQLResponseType, 'data'> & {
data?: TData;
};
export interface ApolloServerTestClient {
query<TData = any, TVariables = Record<string, any>>(query: Query<TVariables>): Promise<GraphQLResponse<TData>>;
mutate<TData = any, TVariables = Record<string, any>>(mutation: Mutation<TVariables>): Promise<GraphQLResponse<TData>>;
}
declare const _default: (server: ApolloServerBase) => ApolloServerTestClient;
export default _default;
//# sourceMappingURL=createTestClient.d.ts.map