UNPKG

1.09 kBTypeScriptView Raw
1import { ApolloServerBase } from 'apollo-server-core';
2import { GraphQLResponse as GraphQLResponseType } from 'apollo-server-types';
3import { DocumentNode } from 'graphql';
4declare type StringOrAst = string | DocumentNode;
5declare type Query<TVariables = Record<string, any>> = {
6 query: StringOrAst;
7 mutation?: undefined;
8 variables?: TVariables;
9 operationName?: string;
10};
11declare type Mutation<TVariables = Record<string, any>> = {
12 mutation: StringOrAst;
13 query?: undefined;
14 variables?: TVariables;
15 operationName?: string;
16};
17declare type GraphQLResponse<TData> = Omit<GraphQLResponseType, 'data'> & {
18 data?: TData;
19};
20export interface ApolloServerTestClient {
21 query<TData = any, TVariables = Record<string, any>>(query: Query<TVariables>): Promise<GraphQLResponse<TData>>;
22 mutate<TData = any, TVariables = Record<string, any>>(mutation: Mutation<TVariables>): Promise<GraphQLResponse<TData>>;
23}
24declare const _default: (server: ApolloServerBase) => ApolloServerTestClient;
25export default _default;
26//# sourceMappingURL=createTestClient.d.ts.map
\No newline at end of file