apollo-server/src/integrations/hapiApollo.test.ts
Nick Nance 40e8b55594 HAPI Integration Refactor (#127)
* convert hapi plugin classes to functions
* create Hapi plugin options
* improve error handling
* working batch query
* add route config options
* improve HAPIGraphiQL api
* update documentation
2016-09-09 07:49:23 -05:00

37 lines
802 B
TypeScript

import * as hapi from 'hapi';
import { ApolloHAPI, GraphiQLHAPI, HAPIPluginOptions } from './hapiApollo';
import testSuite, { Schema } from './integrations.test';
function createApp(createOptions: HAPIPluginOptions) {
const server = new hapi.Server();
server.connection({
host: 'localhost',
port: 8000,
});
server.register({
register: ApolloHAPI,
options: {
apolloOptions: createOptions ? createOptions.apolloOptions : { schema: Schema },
path: '/graphql',
},
});
server.register({
register: GraphiQLHAPI,
options: {
path: '/graphiql',
graphiqlOptions: {
endpointURL: '/graphql',
},
},
});
return server.listener;
}
describe('integration:HAPI', () => {
testSuite(createApp);
});