From 3fe77d9dd591daf6a022035bc8788294a7a78e93 Mon Sep 17 00:00:00 2001 From: Mike Williamson Date: Thu, 25 Jan 2018 18:20:04 -0500 Subject: [PATCH] Update location of DirectiveLocation DirectiveLocation moved in the latest version of Graphql.js. This commit updates the location and fixes a test for normal execution. --- package.json | 2 +- src/directives/currency.js | 2 +- src/directives/date.js | 4 ++-- src/directives/number.js | 2 +- src/directives/string.js | 4 ++-- test/index.js | 2 +- test/utils.js | 5 +++-- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index b8ed61d..9a38881 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "coveralls": "^2.11.14", "eslint": "^3.8.0", "eslint-config-google": "^0.6.0", - "graphql": "^0.10.1", + "graphql": "^0.12.0", "mocha": "^3.1.2", "nyc": "^8.3.1" } diff --git a/src/directives/currency.js b/src/directives/currency.js index 838d422..21cbcba 100644 --- a/src/directives/currency.js +++ b/src/directives/currency.js @@ -1,5 +1,5 @@ import { GraphQLString } from 'graphql'; -import { DirectiveLocation } from 'graphql/type/directives'; +import { DirectiveLocation } from 'graphql/language/directiveLocation'; import { GraphQLCustomDirective } from '../custom'; import numeral from 'numeral'; diff --git a/src/directives/date.js b/src/directives/date.js index 4942a17..08d1754 100644 --- a/src/directives/date.js +++ b/src/directives/date.js @@ -1,5 +1,5 @@ import { GraphQLString, GraphQLBoolean } from 'graphql'; -import { DirectiveLocation } from 'graphql/type/directives'; +import { DirectiveLocation } from 'graphql/language/directiveLocation'; import { GraphQLCustomDirective } from '../custom'; import { _ } from 'lodash'; @@ -64,4 +64,4 @@ exports.GraphQLTimeOffsetDirective = new GraphQLCustomDirective({ } }); } -}); \ No newline at end of file +}); diff --git a/src/directives/number.js b/src/directives/number.js index 0f5d73d..01cdc6e 100644 --- a/src/directives/number.js +++ b/src/directives/number.js @@ -1,5 +1,5 @@ import { GraphQLString } from 'graphql'; -import { DirectiveLocation } from 'graphql/type/directives'; +import { DirectiveLocation } from 'graphql/language/directiveLocation'; import { GraphQLCustomDirective } from '../custom'; import numeral from 'numeral'; diff --git a/src/directives/string.js b/src/directives/string.js index e4e3bdc..9c894dd 100644 --- a/src/directives/string.js +++ b/src/directives/string.js @@ -1,4 +1,4 @@ -import { DirectiveLocation } from 'graphql/type/directives'; +import { DirectiveLocation } from 'graphql/language/directiveLocation'; import { GraphQLString, GraphQLNonNull } from 'graphql'; import { GraphQLCustomDirective } from '../custom'; @@ -78,4 +78,4 @@ exports.GraphQLTemplateDirective = new GraphQLCustomDirective({ return output; }); } -}); \ No newline at end of file +}); diff --git a/test/index.js b/test/index.js index 9c2868f..591c33f 100644 --- a/test/index.js +++ b/test/index.js @@ -1,6 +1,6 @@ import { GraphQLCustomDirective, applySchemaCustomDirectives } from '../src/index'; import { GraphQLInt, GraphQLSchema, GraphQLObjectType, GraphQLNonNull, GraphQLList, graphql, buildSchema } from 'graphql'; -import { DirectiveLocation } from 'graphql/type/directives'; +import { DirectiveLocation } from 'graphql/language/directiveLocation'; import { createGraphQLQueryDeepObject, testEqual, testNullEqual } from './utils'; import { expect } from 'chai'; diff --git a/test/utils.js b/test/utils.js index 810bff3..141b56c 100644 --- a/test/utils.js +++ b/test/utils.js @@ -7,6 +7,7 @@ const DEFAULT_TEST_SCHEMA = `type Query { value(input: String): String } schema exports.testEqual = function({ directives, query, schema, input, passServer = false, expected, done, context }) { + let executionSchema = buildSchema(schema || DEFAULT_TEST_SCHEMA); if (!schema) { @@ -16,14 +17,14 @@ exports.testEqual = function({ directives, query, schema, input, passServer = fa } } - executionSchema._directives = executionSchema._directives.concat(directives); + if (directives) + executionSchema._directives = executionSchema._directives.concat(directives); applySchemaCustomDirectives(executionSchema); graphql(executionSchema, query, input, context) .then(({data, errors }) => { if (errors) { - console.error(errors); throw new Error(errors); } expect(data).to.eql(expected);