Skip to content

Instantly share code, notes, and snippets.

View dipiash's full-sized avatar

Dmitriy Pashkevich dipiash

View GitHub Profile
@dipiash
dipiash / createTestClient.ts
Created November 11, 2020 19:12 — forked from preetjdp/createTestClient.ts
Allows to test Apollo GraphQL Server
/**
* The following file is an amalgamation of [Apollo Server Testing](https://github.com/apollographql/apollo-server/blob/main/packages/apollo-server-testing/src/createTestClient.ts)
* and [apollo-server-integration-testing](https://github.com/zapier/apollo-server-integration-testing),
* this allows the use of `headers` while making a request
*
* Credits to the original authors
*/
import express from 'express';
import { convertNodeHttpToRequest, runHttpQuery } from 'apollo-server-core';