Vulcan/packages/vulcan-lib/test/server/apollo-server.test.js

53 lines
1.7 KiB
JavaScript
Raw Normal View History

2019-01-30 21:26:43 +01:00
import { createApolloServer } from '../../lib/server/apollo-server/apollo_server2';
//import initGraphQL from '../../lib/server/apollo-server/initGraphQL';
//import { GraphQLSchema } from '../../lib/modules/graphql';
2019-01-11 16:40:42 +01:00
import expect from 'expect';
2019-01-30 10:42:17 +09:00
import { executableSchema } from './fixtures/minimalSchema';
2019-01-11 16:40:42 +01:00
const test = it; // TODO: just before we switch to jest
// @see https://www.apollographql.com/docs/apollo-server/features/testing.html
2019-01-11 16:40:42 +01:00
describe('apollo-server', function() {
2019-01-29 17:32:08 +01:00
let options;
before(function() {
// TODO: does not work in this test. This should setup the schema.
// initGraphQL();
2019-01-11 16:40:42 +01:00
2019-01-29 17:32:08 +01:00
options = {
2019-01-30 21:26:43 +01:00
config: {}, //defaultConfig,
2019-01-29 17:32:08 +01:00
// Apollo options
apolloServerOptions: {
// TODO: check why this fails. One of the schema defined
// in one of the test file (when running createCollection in a test)
// is not working as expected
//schema: GraphQLSchema.getExecutableSchema(),
schema: executableSchema,
//formatError,
//tracing: getSetting('apolloTracing', Meteor.isDevelopment),
cacheControl: true,
//context
},
// Apollo applyMiddleware Option
apolloApplyMiddlewareOptions: {},
};
});
describe('createServer', function() {
test('init server', function() {
const server = createApolloServer(options);
expect(server).toBeDefined();
2019-01-11 16:40:42 +01:00
});
2019-01-29 17:32:08 +01:00
});
describe('setupWebApp', function() {});
describe('compute context', function() {
test.skip('inital context contains data loaders', function() {
// TODO
2019-01-11 16:40:42 +01:00
});
2019-01-29 17:32:08 +01:00
test.skip('initial context contains graphQLSchema context', function() {
// TODO
});
test.skip('initial context is merged with provided context', function() {
// TODO
});
2019-01-29 17:32:08 +01:00
});
});