MCPcopy Create free account
hub / github.com/apollographql/fullstack-tutorial / startTestServer

Function startTestServer

final/server/src/__tests__/__utils.js:41–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 */
40
41const startTestServer = async server => {
42 // if using apollo-server-express...
43 // const app = express();
44 // server.applyMiddleware({ app });
45 // const httpServer = await app.listen(0);
46
47 const httpServer = await server.listen({ port: 0 });
48
49 const link = new HttpLink({
50 uri: `http://localhost:${httpServer.port}`,
51 fetch,
52 });
53
54 const executeOperation = ({ query, variables = {} }) =>
55 execute(link, { query, variables });
56
57 return {
58 link,
59 stop: () => httpServer.server.close(),
60 graphql: executeOperation,
61 };
62};
63
64module.exports.startTestServer = startTestServer;

Callers 1

e2e.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected