2016-07-28 20:19:39 -07:00
|
|
|
import * as connect from 'connect';
|
|
|
|
import * as bodyParser from 'body-parser';
|
|
|
|
import { apolloConnect, graphiqlConnect } from './connectApollo';
|
2016-10-03 23:13:08 +03:00
|
|
|
import 'mocha';
|
2016-07-28 20:19:39 -07:00
|
|
|
|
2016-10-18 09:36:07 +03:00
|
|
|
import testSuite, { Schema, CreateAppOptions } from 'graphql-server-integration-testsuite';
|
2016-07-28 20:19:39 -07:00
|
|
|
|
|
|
|
function createConnectApp(options: CreateAppOptions = {}) {
|
|
|
|
const app = connect();
|
|
|
|
|
|
|
|
options.apolloOptions = options.apolloOptions || { schema: Schema };
|
|
|
|
if (!options.excludeParser) {
|
|
|
|
app.use('/graphql', bodyParser.json());
|
|
|
|
}
|
|
|
|
if (options.graphiqlOptions ) {
|
|
|
|
app.use('/graphiql', graphiqlConnect( options.graphiqlOptions ));
|
|
|
|
}
|
|
|
|
app.use('/graphql', apolloConnect( options.apolloOptions ));
|
|
|
|
return app;
|
|
|
|
}
|
|
|
|
|
|
|
|
describe('integration:Connect', () => {
|
|
|
|
testSuite(createConnectApp);
|
|
|
|
});
|