pluginTestHarness.d.ts 1.2 KB

12345678910111213141516171819
  1. import { WithRequired, GraphQLRequest, GraphQLRequestContextExecutionDidStart, GraphQLResponse, ValueOrPromise, GraphQLRequestContextWillSendResponse, Logger } from 'apollo-server-types';
  2. import { GraphQLSchema } from 'graphql/type';
  3. import { CacheHint } from 'apollo-cache-control';
  4. import { ApolloServerPlugin } from 'apollo-server-plugin-base';
  5. declare type IPluginTestHarnessGraphqlRequest = WithRequired<GraphQLRequest, 'query'>;
  6. declare type IPluginTestHarnessExecutionDidStart<TContext> = GraphQLRequestContextExecutionDidStart<TContext> & {
  7. request: IPluginTestHarnessGraphqlRequest;
  8. };
  9. export default function pluginTestHarness<TContext>({ pluginInstance, schema, logger, graphqlRequest, overallCachePolicy, executor, context }: {
  10. pluginInstance: ApolloServerPlugin<TContext>;
  11. schema?: GraphQLSchema;
  12. logger?: Logger;
  13. graphqlRequest: IPluginTestHarnessGraphqlRequest;
  14. overallCachePolicy?: Required<CacheHint>;
  15. executor: (requestContext: IPluginTestHarnessExecutionDidStart<TContext>) => ValueOrPromise<GraphQLResponse>;
  16. context?: TContext;
  17. }): Promise<GraphQLRequestContextWillSendResponse<TContext>>;
  18. export {};
  19. //# sourceMappingURL=pluginTestHarness.d.ts.map