Skip to content

Commit

Permalink
tests(op-reg): Use shared EngineReportingOptions.
Browse files Browse the repository at this point in the history
These are all meant to be the same in all cases.
  • Loading branch information
abernix committed Jun 27, 2020
1 parent 0f9e170 commit 9766f7a
Showing 1 changed file with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from './helpers.test-helpers';
import { Headers } from 'apollo-server-env';
import { GraphQLRequest } from 'apollo-server-plugin-base';
import { EngineReportingOptions } from 'apollo-engine-reporting';

// While not ideal, today, Apollo Server has a very real expectation of an HTTP
// request context. That will change in the future. While we can sometimes
Expand Down Expand Up @@ -51,6 +52,10 @@ describe('Operation registry plugin', () => {
const graphId = 'test-service';
const apiKey = `service:${graphId}:not-an-api-key`;
const hashedApiKey = hashApiKey(apiKey);
const engineOptions: EngineReportingOptions<any> = {
apiKey,
sendReportsImmediately: true,
};
const typeDefs = gql`
type Query {
hello: String
Expand Down Expand Up @@ -88,10 +93,7 @@ describe('Operation registry plugin', () => {
const server = new ApolloServerMock({
typeDefs,
mockEntireSchema: true,
engine: {
apiKey,
sendReportsImmediately: true,
},
engine: engineOptions,
plugins: [
plugin({
onUnregisteredOperation,
Expand Down Expand Up @@ -141,10 +143,7 @@ describe('Operation registry plugin', () => {
const server = new ApolloServerMock({
typeDefs,
mockEntireSchema: true,
engine: {
apiKey,
sendReportsImmediately: true,
},
engine: engineOptions,
plugins: [
plugin({
onUnregisteredOperation,
Expand Down Expand Up @@ -180,10 +179,7 @@ describe('Operation registry plugin', () => {
const server = new ApolloServerMock({
typeDefs,
mockEntireSchema: true,
engine: {
apiKey,
sendReportsImmediately: true,
},
engine: engineOptions,
plugins: [
plugin({
forbidUnregisteredOperations,
Expand Down Expand Up @@ -236,10 +232,7 @@ describe('Operation registry plugin', () => {
const server = new ApolloServerMock({
typeDefs,
mockEntireSchema: true,
engine: {
apiKey,
sendReportsImmediately: true,
},
engine: engineOptions,
plugins: [
plugin({
forbidUnregisteredOperations,
Expand Down Expand Up @@ -277,10 +270,7 @@ describe('Operation registry plugin', () => {
const server = new ApolloServerMock({
typeDefs,
mockEntireSchema: true,
engine: {
apiKey,
sendReportsImmediately: true,
},
engine: engineOptions,
plugins: [
plugin({
onForbiddenOperation,
Expand Down

0 comments on commit 9766f7a

Please sign in to comment.