2016-07-05 17:25:18 -07:00
|
|
|
import * as hapi from 'hapi';
|
2016-10-22 18:48:23 -07:00
|
|
|
import { graphqlHapi, graphiqlHapi, HapiPluginOptions } from './hapiApollo';
|
2016-10-03 23:13:08 +03:00
|
|
|
import 'mocha';
|
2016-07-05 17:25:18 -07:00
|
|
|
|
2016-10-18 09:36:07 +03:00
|
|
|
import testSuite, { Schema } from 'graphql-server-integration-testsuite';
|
2016-07-05 17:25:18 -07:00
|
|
|
|
2016-09-09 20:22:13 -05:00
|
|
|
function createApp(createOptions: HapiPluginOptions) {
|
2016-07-05 17:25:18 -07:00
|
|
|
const server = new hapi.Server();
|
|
|
|
|
|
|
|
server.connection({
|
|
|
|
host: 'localhost',
|
|
|
|
port: 8000,
|
|
|
|
});
|
|
|
|
|
|
|
|
server.register({
|
2016-10-22 18:48:23 -07:00
|
|
|
register: graphqlHapi,
|
2016-09-09 07:49:23 -05:00
|
|
|
options: {
|
2016-10-22 23:52:32 -07:00
|
|
|
graphqlOptions: createOptions ? createOptions.graphqlOptions : { schema: Schema },
|
2016-09-09 07:49:23 -05:00
|
|
|
path: '/graphql',
|
|
|
|
},
|
2016-07-05 17:25:18 -07:00
|
|
|
});
|
|
|
|
|
2016-07-06 07:05:59 -07:00
|
|
|
server.register({
|
2016-09-14 20:35:32 -07:00
|
|
|
register: graphiqlHapi,
|
2016-09-09 07:49:23 -05:00
|
|
|
options: {
|
|
|
|
path: '/graphiql',
|
|
|
|
graphiqlOptions: {
|
|
|
|
endpointURL: '/graphql',
|
|
|
|
},
|
|
|
|
},
|
2016-07-06 07:05:59 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
return server.listener;
|
2016-07-05 17:25:18 -07:00
|
|
|
}
|
|
|
|
|
2016-09-09 20:22:13 -05:00
|
|
|
describe('integration:Hapi', () => {
|
2016-07-07 08:46:10 -07:00
|
|
|
testSuite(createApp);
|
|
|
|
});
|