apollo-server/src/integrations/hapiApollo.test.ts

30 lines
664 B
TypeScript
Raw Normal View History

2016-07-05 17:25:18 -07:00
import * as hapi from 'hapi';
2016-07-06 07:05:59 -07:00
import { ApolloHAPI, GraphiQLHAPI } from './hapiApollo';
2016-07-05 17:25:18 -07:00
import testSuite, { Schema, CreateAppOptions } from './integrations.test';
function createApp(options: CreateAppOptions = {}) {
const server = new hapi.Server();
server.connection({
host: 'localhost',
port: 8000,
});
server.register({
2016-07-06 07:05:59 -07:00
register: new ApolloHAPI(),
2016-07-05 17:25:18 -07:00
options: { schema: Schema },
routes: { prefix: '/graphql' },
});
2016-07-06 07:05:59 -07:00
server.register({
register: new GraphiQLHAPI(),
options: { endpointURL: '/graphql' },
routes: { prefix: '/graphql' },
});
return server.listener;
2016-07-05 17:25:18 -07:00
}
2016-07-07 06:35:20 -07:00
testSuite(createApp, 'HAPI');