Skip to content

Commit

Permalink
Tests using ApolloServerExpressConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
KATT committed Feb 21, 2019
1 parent 5f1d824 commit defd741
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Expand Up @@ -7,8 +7,12 @@ import FormData from 'form-data';
import fs from 'fs';
import { createApolloFetch } from 'apollo-fetch';

import { gql, AuthenticationError, Config } from 'apollo-server-core';
import { ApolloServer, ServerRegistration } from '../ApolloServer';
import { gql, AuthenticationError } from 'apollo-server-core';
import {
ApolloServer,
ApolloServerExpressConfig,
ServerRegistration,
} from '../ApolloServer';

import {
NODE_MAJOR_VERSION,
Expand Down Expand Up @@ -57,7 +61,7 @@ describe('apollo-server-express', () => {
let httpServer: http.Server;

async function createServer(
serverOptions: Config,
serverOptions: ApolloServerExpressConfig,
options: Partial<ServerRegistration> = {},
) {
server = new ApolloServer(serverOptions);
Expand Down
@@ -1,7 +1,6 @@
import connect from 'connect';
import query from 'qs-middleware';
import { ApolloServer } from '../ApolloServer';
import { Config } from 'apollo-server-core';
import { ApolloServer, ApolloServerExpressConfig } from '../ApolloServer';

import testSuite, {
schema as Schema,
Expand All @@ -17,7 +16,7 @@ function createConnectApp(options: CreateAppOptions = {}) {
// connect is probably already using connect-query or qs-middleware.
app.use(query());
const server = new ApolloServer(
(options.graphqlOptions as Config) || { schema: Schema },
(options.graphqlOptions as ApolloServerExpressConfig) || { schema: Schema },
);
// See comment on ServerRegistration.app for its typing.
server.applyMiddleware({ app: app as any });
Expand Down
@@ -1,16 +1,16 @@
import express from 'express';
import { ApolloServer } from '../ApolloServer';
import { ApolloServer, ApolloServerExpressConfig } from '../ApolloServer';
import testSuite, {
schema as Schema,
CreateAppOptions,
} from 'apollo-server-integration-testsuite';
import { GraphQLOptions, Config } from 'apollo-server-core';
import { GraphQLOptions } from 'apollo-server-core';

function createApp(options: CreateAppOptions = {}) {
const app = express();

const server = new ApolloServer(
(options.graphqlOptions as Config) || { schema: Schema },
(options.graphqlOptions as ApolloServerExpressConfig) || { schema: Schema },
);
server.applyMiddleware({ app });
return app;
Expand Down

0 comments on commit defd741

Please sign in to comment.