mirror of
https://github.com/vale981/apollo-server
synced 2025-03-09 20:47:00 -04:00
24 lines
755 B
TypeScript
24 lines
755 B
TypeScript
import * as connect from 'connect';
|
|
import * as bodyParser from 'body-parser';
|
|
import { apolloConnect, graphiqlConnect } from './connectApollo';
|
|
import 'mocha';
|
|
|
|
import testSuite, { Schema, CreateAppOptions } from 'graphql-server-integration-testsuite';
|
|
|
|
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);
|
|
});
|