mirror of
https://github.com/vale981/apollo-server
synced 2025-03-16 07:46:54 -04:00

* Setup prettier and precommit hooks * Format code with prettier * Use husky because it works... * Move prettier config to .prettierrc file * Implement fixing markdown file formatting when running lint-fix script * Format markdown files * Add .json file formatting * Fixes json file formatting * Add pretteir linting step * Remove tslint * Use gitignore for prettier * Fix linting errors * Ignore submodule folder
48 lines
1,008 B
TypeScript
48 lines
1,008 B
TypeScript
import * as hapi from 'hapi';
|
|
import { graphqlHapi, graphiqlHapi } from './hapiApollo';
|
|
import 'mocha';
|
|
|
|
import testSuite, {
|
|
schema as Schema,
|
|
CreateAppOptions,
|
|
} from 'apollo-server-integration-testsuite';
|
|
|
|
async function createApp(options: CreateAppOptions) {
|
|
const server = new hapi.Server({
|
|
host: 'localhost',
|
|
port: 8000,
|
|
});
|
|
|
|
await server.register({
|
|
plugin: graphqlHapi,
|
|
options: {
|
|
graphqlOptions: (options && options.graphqlOptions) || { schema: Schema },
|
|
path: '/graphql',
|
|
},
|
|
});
|
|
|
|
await server.register({
|
|
plugin: graphiqlHapi,
|
|
options: {
|
|
path: '/graphiql',
|
|
graphiqlOptions: (options && options.graphiqlOptions) || {
|
|
endpointURL: '/graphql',
|
|
},
|
|
},
|
|
});
|
|
|
|
await server.start();
|
|
|
|
return server.listener;
|
|
}
|
|
|
|
async function destroyApp(app) {
|
|
if (!app || !app.close) {
|
|
return;
|
|
}
|
|
await new Promise(resolve => app.close(resolve));
|
|
}
|
|
|
|
describe('integration:Hapi', () => {
|
|
testSuite(createApp, destroyApp);
|
|
});
|