Skip to content

Commit

Permalink
Merge ec43ee7 into 5d60519
Browse files Browse the repository at this point in the history
  • Loading branch information
greenkeeperio-bot committed Jan 23, 2017
2 parents 5d60519 + ec43ee7 commit a3fc018
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 79 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -35,7 +35,7 @@
"sinon": "^1.17.6",
"supertest": "^2.0.0",
"supertest-as-promised": "^4.0.0",
"tslint": "^3.13.0",
"tslint": "^4.3.1",
"typescript": "^2.0.3"
}
}
36 changes: 18 additions & 18 deletions packages/graphql-server-core/src/runQuery.test.ts
Expand Up @@ -23,7 +23,7 @@ import { makeCompatible } from 'meteor-promise';
import Fiber = require('fibers');
makeCompatible(Promise, Fiber);

const QueryType = new GraphQLObjectType({
const queryType = new GraphQLObjectType({
name: 'QueryType',
fields: {
testString: {
Expand Down Expand Up @@ -71,15 +71,15 @@ const QueryType = new GraphQLObjectType({
},
});

const Schema = new GraphQLSchema({
query: QueryType,
const schema = new GraphQLSchema({
query: queryType,
});

describe('runQuery', () => {
it('returns the right result when query is a string', () => {
const query = `{ testString }`;
const expected = { testString: 'it works' };
return runQuery({ schema: Schema, query: query })
return runQuery({ schema, query: query })
.then((res) => {
return expect(res.data).to.deep.equal(expected);
});
Expand All @@ -88,7 +88,7 @@ describe('runQuery', () => {
it('returns the right result when query is a document', () => {
const query = parse(`{ testString }`);
const expected = { testString: 'it works' };
return runQuery({ schema: Schema, query: query })
return runQuery({ schema, query: query })
.then((res) => {
return expect(res.data).to.deep.equal(expected);
});
Expand All @@ -98,7 +98,7 @@ describe('runQuery', () => {
const query = `query { test `;
const expected = /Syntax Error GraphQL/;
return runQuery({
schema: Schema,
schema,
query: query,
variables: { base: 1 },
}).then((res) => {
Expand All @@ -113,7 +113,7 @@ describe('runQuery', () => {
const expected = /at resolveOrError/;
const logStub = stub(console, 'error');
return runQuery({
schema: Schema,
schema,
query: query,
debug: true,
}).then((res) => {
Expand All @@ -127,7 +127,7 @@ describe('runQuery', () => {
const query = `query { testError }`;
const logStub = stub(console, 'error');
return runQuery({
schema: Schema,
schema,
query: query,
debug: false,
}).then((res) => {
Expand All @@ -140,7 +140,7 @@ describe('runQuery', () => {
const query = `query TestVar($base: String){ testArgumentValue(base: $base) }`;
const expected = 'Variable "$base" of type "String" used in position expecting type "Int!".';
return runQuery({
schema: Schema,
schema,
query: query,
variables: { base: 1 },
}).then((res) => {
Expand All @@ -156,7 +156,7 @@ describe('runQuery', () => {
const query = parse(`query TestVar($base: String){ testArgumentValue(base: $base) }`);
const expected = { testArgumentValue: 15 };
return runQuery({
schema: Schema,
schema,
query: query,
variables: { base: 1 },
}).then((res) => {
Expand All @@ -167,7 +167,7 @@ describe('runQuery', () => {
it('correctly passes in the rootValue', () => {
const query = `{ testRootValue }`;
const expected = { testRootValue: 'it also works' };
return runQuery({ schema: Schema, query: query, rootValue: 'it also' })
return runQuery({ schema, query: query, rootValue: 'it also' })
.then((res) => {
return expect(res.data).to.deep.equal(expected);
});
Expand All @@ -176,7 +176,7 @@ describe('runQuery', () => {
it('correctly passes in the context', () => {
const query = `{ testContextValue }`;
const expected = { testContextValue: 'it still works' };
return runQuery({ schema: Schema, query: query, context: 'it still' })
return runQuery({ schema, query: query, context: 'it still' })
.then((res) => {
return expect(res.data).to.deep.equal(expected);
});
Expand All @@ -186,7 +186,7 @@ describe('runQuery', () => {
const query = `{ testContextValue }`;
const expected = { testContextValue: 'it still works' };
return runQuery({
schema: Schema,
schema,
query: query,
context: 'it still',
formatResponse: (response, { context }) => {
Expand All @@ -204,7 +204,7 @@ describe('runQuery', () => {
const query = `query TestVar($base: Int!){ testArgumentValue(base: $base) }`;
const expected = { testArgumentValue: 6 };
return runQuery({
schema: Schema,
schema,
query: query,
variables: { base: 1 },
}).then((res) => {
Expand All @@ -216,7 +216,7 @@ describe('runQuery', () => {
const query = `query TestVar($base: Int!){ testArgumentValue(base: $base) }`;
const expected = 'Variable "$base" of required type "Int!" was not provided.';
return runQuery({
schema: Schema,
schema,
query: query,
}).then((res) => {
return expect(res.errors[0].message).to.deep.equal(expected);
Expand All @@ -225,7 +225,7 @@ describe('runQuery', () => {

it('supports yielding resolver functions', () => {
return runQuery({
schema: Schema,
schema,
query: `{ testAwaitedValue }`,
}).then((res) => {
expect(res.data).to.deep.equal({
Expand All @@ -245,7 +245,7 @@ describe('runQuery', () => {
const expected = {
testString: 'it works',
};
return runQuery({ schema: Schema, query: query, operationName: 'Q1' })
return runQuery({ schema, query: query, operationName: 'Q1' })
.then((res) => {
return expect(res.data).to.deep.equal(expected);
});
Expand All @@ -262,7 +262,7 @@ describe('runQuery', () => {
testString: 'it works',
};
return runQuery({
schema: Schema,
schema,
query: query,
operationName: 'Q1',
variables: { test: 123 },
Expand Down
6 changes: 3 additions & 3 deletions packages/graphql-server-core/src/runQuery.ts
Expand Up @@ -17,11 +17,11 @@ export interface GqlResponse {
}

export enum LogAction {
request, parse, validation, execute
request, parse, validation, execute,
}

export enum LogStep {
start, end, status
start, end, status,
}

export interface LogMessage {
Expand Down Expand Up @@ -129,7 +129,7 @@ function doRunQuery(options: QueryOptions): Promise<ExecutionResult> {
options.rootValue,
options.context,
options.variables,
options.operationName
options.operationName,
).then(gqlResponse => {
logFunction({action: LogAction.execute, step: LogStep.end});
logFunction({action: LogAction.request, step: LogStep.end});
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-server-express/src/connectApollo.test.ts
Expand Up @@ -3,7 +3,7 @@ import * as bodyParser from 'body-parser';
import { graphqlConnect, graphiqlConnect } from './connectApollo';
import 'mocha';

import testSuite, { Schema, CreateAppOptions } from 'graphql-server-integration-testsuite';
import testSuite, { schema as Schema, CreateAppOptions } from 'graphql-server-integration-testsuite';

function createConnectApp(options: CreateAppOptions = {}) {
const app = connect();
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-server-express/src/expressApollo.test.ts
@@ -1,7 +1,7 @@
import * as express from 'express';
import * as bodyParser from 'body-parser';
import { graphqlExpress, graphiqlExpress } from './expressApollo';
import testSuite, { Schema, CreateAppOptions } from 'graphql-server-integration-testsuite';
import testSuite, { schema as Schema, CreateAppOptions } from 'graphql-server-integration-testsuite';
import { expect } from 'chai';
import { GraphQLOptions } from 'graphql-server-core';
import 'mocha';
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-server-hapi/src/hapiApollo.test.ts
Expand Up @@ -2,7 +2,7 @@ import * as hapi from 'hapi';
import { graphqlHapi, graphiqlHapi } from './hapiApollo';
import 'mocha';

import testSuite, { Schema, CreateAppOptions } from 'graphql-server-integration-testsuite';
import testSuite, { schema as Schema, CreateAppOptions } from 'graphql-server-integration-testsuite';

function createApp(options: CreateAppOptions) {
const server = new hapi.Server();
Expand Down

0 comments on commit a3fc018

Please sign in to comment.