From 4b55f10f16cc77302613e8ad67440259c68633df Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Tue, 12 Feb 2019 21:56:51 +0200 Subject: [PATCH] Allow for long string literals inside tests (#1730) --- src/__tests__/starWarsIntrospection-test.js | 3 +- src/__tests__/starWarsSchema.js | 3 +- src/execution/__tests__/nonnull-test.js | 7 +-- src/execution/__tests__/variables-test.js | 38 +++++---------- src/subscription/__tests__/subscribe-test.js | 3 +- src/type/__tests__/definition-test.js | 47 ++++++------------- src/type/__tests__/enumType-test.js | 6 +-- src/type/__tests__/introspection-test.js | 21 +++------ src/type/__tests__/validation-test.js | 40 +++++----------- .../__tests__/buildClientSchema-test.js | 6 +-- src/utilities/__tests__/extendSchema-test.js | 6 +-- .../__tests__/FieldsOnCorrectType-test.js | 12 ++--- .../OverlappingFieldsCanBeMerged-test.js | 3 +- src/validation/__tests__/validation-test.js | 12 ++--- 14 files changed, 67 insertions(+), 140 deletions(-) diff --git a/src/__tests__/starWarsIntrospection-test.js b/src/__tests__/starWarsIntrospection-test.js index 34adf7aa19..65211226bc 100644 --- a/src/__tests__/starWarsIntrospection-test.js +++ b/src/__tests__/starWarsIntrospection-test.js @@ -346,8 +346,7 @@ describe('Star Wars Introspection Tests', () => { { defaultValue: null, description: - 'If omitted, returns the hero of the whole saga. ' + - 'If provided, returns the hero of that particular episode.', + 'If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode.', name: 'episode', type: { kind: 'ENUM', diff --git a/src/__tests__/starWarsSchema.js b/src/__tests__/starWarsSchema.js index 0ccaa509b4..497a617b60 100644 --- a/src/__tests__/starWarsSchema.js +++ b/src/__tests__/starWarsSchema.js @@ -262,8 +262,7 @@ const queryType = new GraphQLObjectType({ args: { episode: { description: - 'If omitted, returns the hero of the whole saga. ' + - 'If provided, returns the hero of that particular episode.', + 'If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode.', type: episodeEnum, }, }, diff --git a/src/execution/__tests__/nonnull-test.js b/src/execution/__tests__/nonnull-test.js index 1e65bbaac7..1fa36a7368 100644 --- a/src/execution/__tests__/nonnull-test.js +++ b/src/execution/__tests__/nonnull-test.js @@ -684,8 +684,7 @@ describe('Execute: handles non-nullable types', () => { errors: [ { message: - 'Argument "cannotBeNull" of non-null type "String!" must ' + - 'not be null.', + 'Argument "cannotBeNull" of non-null type "String!" must not be null.', locations: [{ line: 3, column: 42 }], path: ['withNonNullArg'], }, @@ -715,9 +714,7 @@ describe('Execute: handles non-nullable types', () => { errors: [ { message: - 'Argument "cannotBeNull" of required type "String!" was ' + - 'provided the variable "$testVar" which was not provided a ' + - 'runtime value.', + 'Argument "cannotBeNull" of required type "String!" was provided the variable "$testVar" which was not provided a runtime value.', locations: [{ line: 3, column: 42 }], path: ['withNonNullArg'], }, diff --git a/src/execution/__tests__/variables-test.js b/src/execution/__tests__/variables-test.js index c5e721185e..80d09e6b64 100644 --- a/src/execution/__tests__/variables-test.js +++ b/src/execution/__tests__/variables-test.js @@ -372,9 +372,7 @@ describe('Execute: Handles inputs', () => { errors: [ { message: - 'Variable "$input" got invalid value ' + - '{ a: "foo", b: "bar", c: null }; ' + - 'Expected non-nullable type String! not to be null at value.c.', + 'Variable "$input" got invalid value { a: "foo", b: "bar", c: null }; Expected non-nullable type String! not to be null at value.c.', locations: [{ line: 2, column: 16 }], }, ], @@ -388,8 +386,7 @@ describe('Execute: Handles inputs', () => { errors: [ { message: - 'Variable "$input" got invalid value "foo bar"; ' + - 'Expected type TestInputObject to be an object.', + 'Variable "$input" got invalid value "foo bar"; Expected type TestInputObject to be an object.', locations: [{ line: 2, column: 16 }], }, ], @@ -403,8 +400,7 @@ describe('Execute: Handles inputs', () => { errors: [ { message: - 'Variable "$input" got invalid value { a: "foo", b: "bar" }; ' + - 'Field value.c of required type String! was not provided.', + 'Variable "$input" got invalid value { a: "foo", b: "bar" }; Field value.c of required type String! was not provided.', locations: [{ line: 2, column: 16 }], }, ], @@ -423,14 +419,12 @@ describe('Execute: Handles inputs', () => { errors: [ { message: - 'Variable "$input" got invalid value { na: { a: "foo" } }; ' + - 'Field value.na.c of required type String! was not provided.', + 'Variable "$input" got invalid value { na: { a: "foo" } }; Field value.na.c of required type String! was not provided.', locations: [{ line: 2, column: 18 }], }, { message: - 'Variable "$input" got invalid value { na: { a: "foo" } }; ' + - 'Field value.nb of required type String! was not provided.', + 'Variable "$input" got invalid value { na: { a: "foo" } }; Field value.nb of required type String! was not provided.', locations: [{ line: 2, column: 18 }], }, ], @@ -447,9 +441,7 @@ describe('Execute: Handles inputs', () => { errors: [ { message: - 'Variable "$input" got invalid value ' + - '{ a: "foo", b: "bar", c: "baz", extra: "dog" }; ' + - 'Field "extra" is not defined by type TestInputObject.', + 'Variable "$input" got invalid value { a: "foo", b: "bar", c: "baz", extra: "dog" }; Field "extra" is not defined by type TestInputObject.', locations: [{ line: 2, column: 16 }], }, ], @@ -695,8 +687,7 @@ describe('Execute: Handles inputs', () => { errors: [ { message: - 'Variable "$value" got invalid value [1, 2, 3]; Expected type ' + - 'String; String cannot represent a non string value: [1, 2, 3]', + 'Variable "$value" got invalid value [1, 2, 3]; Expected type String; String cannot represent a non string value: [1, 2, 3]', locations: [{ line: 2, column: 16 }], }, ], @@ -724,8 +715,7 @@ describe('Execute: Handles inputs', () => { errors: [ { message: - 'Argument "input" of required type "String!" was provided the ' + - 'variable "$foo" which was not provided a runtime value.', + 'Argument "input" of required type "String!" was provided the variable "$foo" which was not provided a runtime value.', locations: [{ line: 3, column: 50 }], path: ['fieldWithNonNullableStringInput'], }, @@ -843,8 +833,7 @@ describe('Execute: Handles inputs', () => { errors: [ { message: - 'Variable "$input" got invalid value ["A", null, "B"]; ' + - 'Expected non-nullable type String! not to be null at value[1].', + 'Variable "$input" got invalid value ["A", null, "B"]; Expected non-nullable type String! not to be null at value[1].', locations: [{ line: 2, column: 16 }], }, ], @@ -893,8 +882,7 @@ describe('Execute: Handles inputs', () => { errors: [ { message: - 'Variable "$input" got invalid value ["A", null, "B"]; ' + - 'Expected non-nullable type String! not to be null at value[1].', + 'Variable "$input" got invalid value ["A", null, "B"]; Expected non-nullable type String! not to be null at value[1].', locations: [{ line: 2, column: 16 }], }, ], @@ -913,8 +901,7 @@ describe('Execute: Handles inputs', () => { errors: [ { message: - 'Variable "$input" expected value of type "TestType!" which ' + - 'cannot be used as an input type.', + 'Variable "$input" expected value of type "TestType!" which cannot be used as an input type.', locations: [{ line: 2, column: 24 }], }, ], @@ -933,8 +920,7 @@ describe('Execute: Handles inputs', () => { errors: [ { message: - 'Variable "$input" expected value of type "UnknownType!" which ' + - 'cannot be used as an input type.', + 'Variable "$input" expected value of type "UnknownType!" which cannot be used as an input type.', locations: [{ line: 2, column: 24 }], }, ], diff --git a/src/subscription/__tests__/subscribe-test.js b/src/subscription/__tests__/subscribe-test.js index 603f1b816e..f136b0e9f2 100644 --- a/src/subscription/__tests__/subscribe-test.js +++ b/src/subscription/__tests__/subscribe-test.js @@ -475,8 +475,7 @@ describe('Subscription Initialization Phase', () => { errors: [ { message: - 'Variable "$priority" got invalid value "meow"; Expected ' + - 'type Int; Int cannot represent non-integer value: "meow"', + 'Variable "$priority" got invalid value "meow"; Expected type Int; Int cannot represent non-integer value: "meow"', locations: [{ line: 2, column: 21 }], }, ], diff --git a/src/type/__tests__/definition-test.js b/src/type/__tests__/definition-test.js index 8f6d0b0389..a1078673d7 100644 --- a/src/type/__tests__/definition-test.js +++ b/src/type/__tests__/definition-test.js @@ -114,9 +114,7 @@ describe('Type System: Scalars', () => { }), ), ).to.throw( - 'SomeScalar must provide "serialize" function. If this custom Scalar ' + - 'is also used as an input type, ensure "parseValue" and "parseLiteral" ' + - 'functions are also provided.', + 'SomeScalar must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.', ); }); @@ -130,9 +128,7 @@ describe('Type System: Scalars', () => { }), ), ).to.throw( - 'SomeScalar must provide "serialize" function. If this custom Scalar ' + - 'is also used as an input type, ensure "parseValue" and "parseLiteral" ' + - 'functions are also provided.', + 'SomeScalar must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.', ); }); @@ -330,8 +326,7 @@ describe('Type System: Objects', () => { fields: [{ field: GraphQLString }], }); expect(() => objType.getFields()).to.throw( - 'SomeObject fields must be an object with field names as keys or a ' + - 'function which returns such an object.', + 'SomeObject fields must be an object with field names as keys or a function which returns such an object.', ); }); @@ -344,8 +339,7 @@ describe('Type System: Objects', () => { }, }); expect(() => objType.getFields()).to.throw( - 'SomeObject fields must be an object with field names as keys or a ' + - 'function which returns such an object.', + 'SomeObject fields must be an object with field names as keys or a function which returns such an object.', ); }); @@ -377,8 +371,7 @@ describe('Type System: Objects', () => { return schemaWithFieldType(OldObject); }).to.throw( - 'OldObject.field should provide "deprecationReason" instead ' + - 'of "isDeprecated".', + 'OldObject.field should provide "deprecationReason" instead of "isDeprecated".', ); }); @@ -411,16 +404,14 @@ describe('Type System: Objects', () => { it('rejects an empty Object field resolver', () => { // $DisableFlowOnNegativeTest expect(() => schemaWithObjectWithFieldResolver({})).to.throw( - 'BadResolver.badField field resolver must be a function if provided, ' + - 'but got: {}.', + 'BadResolver.badField field resolver must be a function if provided, but got: {}.', ); }); it('rejects a constant scalar value resolver', () => { // $DisableFlowOnNegativeTest expect(() => schemaWithObjectWithFieldResolver(0)).to.throw( - 'BadResolver.badField field resolver must be a function if provided, ' + - 'but got: 0.', + 'BadResolver.badField field resolver must be a function if provided, but got: 0.', ); }); @@ -553,8 +544,7 @@ describe('Type System: Unions', () => { }), ), ).to.throw( - 'Must provide Array of types or a function which returns such an array ' + - 'for Union SomeUnion.', + 'Must provide Array of types or a function which returns such an array for Union SomeUnion.', ); }); }); @@ -647,8 +637,7 @@ describe('Type System: Enums', () => { values: { FOO: null }, }; expect(() => new GraphQLEnumType(config)).to.throw( - 'SomeEnum.FOO must refer to an object with a "value" key representing ' + - 'an internal value but got: null.', + 'SomeEnum.FOO must refer to an object with a "value" key representing an internal value but got: null.', ); }); @@ -659,8 +648,7 @@ describe('Type System: Enums', () => { values: { FOO: 10 }, }; expect(() => new GraphQLEnumType(config)).to.throw( - 'SomeEnum.FOO must refer to an object with a "value" key representing ' + - 'an internal value but got: 10.', + 'SomeEnum.FOO must refer to an object with a "value" key representing an internal value but got: 10.', ); }); @@ -673,8 +661,7 @@ describe('Type System: Enums', () => { }, }; expect(() => new GraphQLEnumType(config)).to.throw( - 'SomeEnum.FOO should provide "deprecationReason" instead ' + - 'of "isDeprecated".', + 'SomeEnum.FOO should provide "deprecationReason" instead of "isDeprecated".', ); }); }); @@ -710,8 +697,7 @@ describe('Type System: Input Objects', () => { fields: [], }); expect(() => inputObjType.getFields()).to.throw( - 'SomeInputObject fields must be an object with field names as keys or a ' + - 'function which returns such an object.', + 'SomeInputObject fields must be an object with field names as keys or a function which returns such an object.', ); }); @@ -722,8 +708,7 @@ describe('Type System: Input Objects', () => { fields: () => [], }); expect(() => inputObjType.getFields()).to.throw( - 'SomeInputObject fields must be an object with field names as keys or a ' + - 'function which returns such an object.', + 'SomeInputObject fields must be an object with field names as keys or a function which returns such an object.', ); }); }); @@ -738,8 +723,7 @@ describe('Type System: Input Objects', () => { }, }); expect(() => inputObjType.getFields()).to.throw( - 'SomeInputObject.f field has a resolve property, ' + - 'but Input Types cannot define resolvers.', + 'SomeInputObject.f field has a resolve property, but Input Types cannot define resolvers.', ); }); @@ -752,8 +736,7 @@ describe('Type System: Input Objects', () => { }, }); expect(() => inputObjType.getFields()).to.throw( - 'SomeInputObject.f field has a resolve property, ' + - 'but Input Types cannot define resolvers.', + 'SomeInputObject.f field has a resolve property, but Input Types cannot define resolvers.', ); }); }); diff --git a/src/type/__tests__/enumType-test.js b/src/type/__tests__/enumType-test.js index aacaa03dfe..71034df8ad 100644 --- a/src/type/__tests__/enumType-test.js +++ b/src/type/__tests__/enumType-test.js @@ -292,8 +292,7 @@ describe('Type System: Enum Values', () => { errors: [ { message: - 'Variable "$color" of type "String!" used in position ' + - 'expecting type "Color".', + 'Variable "$color" of type "String!" used in position expecting type "Color".', locations: [{ line: 1, column: 8 }, { line: 1, column: 47 }], }, ], @@ -308,8 +307,7 @@ describe('Type System: Enum Values', () => { errors: [ { message: - 'Variable "$color" of type "Int!" used in position ' + - 'expecting type "Color".', + 'Variable "$color" of type "Int!" used in position expecting type "Color".', locations: [{ line: 1, column: 8 }, { line: 1, column: 44 }], }, ], diff --git a/src/type/__tests__/introspection-test.js b/src/type/__tests__/introspection-test.js index def914abe8..67ad991c06 100644 --- a/src/type/__tests__/introspection-test.js +++ b/src/type/__tests__/introspection-test.js @@ -1307,14 +1307,12 @@ describe('Introspection', () => { { name: 'mutationType', description: - 'If this server supports mutation, the type that ' + - 'mutation operations will be rooted at.', + 'If this server supports mutation, the type that mutation operations will be rooted at.', }, { name: 'subscriptionType', description: - 'If this server support subscription, the type ' + - 'that subscription operations will be rooted at.', + 'If this server support subscription, the type that subscription operations will be rooted at.', }, { name: 'directives', @@ -1361,32 +1359,27 @@ describe('Introspection', () => { }, { description: - 'Indicates this type is an object. ' + - '`fields` and `interfaces` are valid fields.', + 'Indicates this type is an object. `fields` and `interfaces` are valid fields.', name: 'OBJECT', }, { description: - 'Indicates this type is an interface. ' + - '`fields` and `possibleTypes` are valid fields.', + 'Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.', name: 'INTERFACE', }, { description: - 'Indicates this type is a union. ' + - '`possibleTypes` is a valid field.', + 'Indicates this type is a union. `possibleTypes` is a valid field.', name: 'UNION', }, { description: - 'Indicates this type is an enum. ' + - '`enumValues` is a valid field.', + 'Indicates this type is an enum. `enumValues` is a valid field.', name: 'ENUM', }, { description: - 'Indicates this type is an input object. ' + - '`inputFields` is a valid field.', + 'Indicates this type is an input object. `inputFields` is a valid field.', name: 'INPUT_OBJECT', }, { diff --git a/src/type/__tests__/validation-test.js b/src/type/__tests__/validation-test.js index 3b90a0b88a..d0e912265b 100644 --- a/src/type/__tests__/validation-test.js +++ b/src/type/__tests__/validation-test.js @@ -466,8 +466,7 @@ describe('Type System: Objects must have fields', () => { expect(validateSchema(schema)).to.deep.equal([ { message: - 'Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but ' + - '"bad-name-with-dashes" does not.', + 'Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "bad-name-with-dashes" does not.', }, ]); }); @@ -489,8 +488,7 @@ describe('Type System: Objects must have fields', () => { expect(validateSchema(schemaBad)).to.deep.equal([ { message: - 'Name "__badName" must not begin with "__", which is reserved by ' + - 'GraphQL introspection.', + 'Name "__badName" must not begin with "__", which is reserved by GraphQL introspection.', }, ]); expect(validateSchema(schemaOk)).to.deep.equal([]); @@ -1537,8 +1535,7 @@ describe('Objects must adhere to Interface they implement', () => { expect(validateSchema(schema)).to.deep.equal([ { message: - 'Interface field AnotherInterface.field expected but ' + - 'AnotherObject does not provide it.', + 'Interface field AnotherInterface.field expected but AnotherObject does not provide it.', locations: [{ line: 7, column: 9 }, { line: 10, column: 7 }], }, ]); @@ -1561,8 +1558,7 @@ describe('Objects must adhere to Interface they implement', () => { expect(validateSchema(schema)).to.deep.equal([ { message: - 'Interface field AnotherInterface.field expects type String but ' + - 'AnotherObject.field is type Int.', + 'Interface field AnotherInterface.field expects type String but AnotherObject.field is type Int.', locations: [{ line: 7, column: 31 }, { line: 11, column: 31 }], }, ]); @@ -1588,8 +1584,7 @@ describe('Objects must adhere to Interface they implement', () => { expect(validateSchema(schema)).to.deep.equal([ { message: - 'Interface field AnotherInterface.field expects type A but ' + - 'AnotherObject.field is type B.', + 'Interface field AnotherInterface.field expects type A but AnotherObject.field is type B.', locations: [{ line: 10, column: 16 }, { line: 14, column: 16 }], }, ]); @@ -1652,8 +1647,7 @@ describe('Objects must adhere to Interface they implement', () => { expect(validateSchema(schema)).to.deep.equal([ { message: - 'Interface field argument AnotherInterface.field(input:) expected ' + - 'but AnotherObject.field does not provide it.', + 'Interface field argument AnotherInterface.field(input:) expected but AnotherObject.field does not provide it.', locations: [{ line: 7, column: 15 }, { line: 11, column: 9 }], }, ]); @@ -1676,8 +1670,7 @@ describe('Objects must adhere to Interface they implement', () => { expect(validateSchema(schema)).to.deep.equal([ { message: - 'Interface field argument AnotherInterface.field(input:) expects ' + - 'type String but AnotherObject.field(input:) is type Int.', + 'Interface field argument AnotherInterface.field(input:) expects type String but AnotherObject.field(input:) is type Int.', locations: [{ line: 7, column: 22 }, { line: 11, column: 22 }], }, ]); @@ -1700,14 +1693,12 @@ describe('Objects must adhere to Interface they implement', () => { expect(validateSchema(schema)).to.deep.equal([ { message: - 'Interface field AnotherInterface.field expects type String but ' + - 'AnotherObject.field is type Int.', + 'Interface field AnotherInterface.field expects type String but AnotherObject.field is type Int.', locations: [{ line: 7, column: 31 }, { line: 11, column: 28 }], }, { message: - 'Interface field argument AnotherInterface.field(input:) expects ' + - 'type String but AnotherObject.field(input:) is type Int.', + 'Interface field argument AnotherInterface.field(input:) expects type String but AnotherObject.field(input:) is type Int.', locations: [{ line: 7, column: 22 }, { line: 11, column: 22 }], }, ]); @@ -1735,9 +1726,7 @@ describe('Objects must adhere to Interface they implement', () => { expect(validateSchema(schema)).to.deep.equal([ { message: - 'Object field AnotherObject.field includes required argument ' + - 'requiredArg that is missing from the Interface field ' + - 'AnotherInterface.field.', + 'Object field AnotherObject.field includes required argument requiredArg that is missing from the Interface field AnotherInterface.field.', locations: [{ line: 13, column: 11 }, { line: 7, column: 9 }], }, ]); @@ -1777,8 +1766,7 @@ describe('Objects must adhere to Interface they implement', () => { expect(validateSchema(schema)).to.deep.equal([ { message: - 'Interface field AnotherInterface.field expects type [String] ' + - 'but AnotherObject.field is type String.', + 'Interface field AnotherInterface.field expects type [String] but AnotherObject.field is type String.', locations: [{ line: 7, column: 16 }, { line: 11, column: 16 }], }, ]); @@ -1801,8 +1789,7 @@ describe('Objects must adhere to Interface they implement', () => { expect(validateSchema(schema)).to.deep.equal([ { message: - 'Interface field AnotherInterface.field expects type String but ' + - 'AnotherObject.field is type [String].', + 'Interface field AnotherInterface.field expects type String but AnotherObject.field is type [String].', locations: [{ line: 7, column: 16 }, { line: 11, column: 16 }], }, ]); @@ -1842,8 +1829,7 @@ describe('Objects must adhere to Interface they implement', () => { expect(validateSchema(schema)).to.deep.equal([ { message: - 'Interface field AnotherInterface.field expects type String! ' + - 'but AnotherObject.field is type String.', + 'Interface field AnotherInterface.field expects type String! but AnotherObject.field is type String.', locations: [{ line: 7, column: 16 }, { line: 11, column: 16 }], }, ]); diff --git a/src/utilities/__tests__/buildClientSchema-test.js b/src/utilities/__tests__/buildClientSchema-test.js index c5d57250e6..b53eaf7828 100644 --- a/src/utilities/__tests__/buildClientSchema-test.js +++ b/src/utilities/__tests__/buildClientSchema-test.js @@ -527,8 +527,7 @@ describe('Type System: build schema from introspection', () => { ); expect(() => buildClientSchema(introspection)).to.throw( - 'Invalid or incomplete schema, unknown type: Query. Ensure that a ' + - 'full introspection query is used in order to build a client schema.', + 'Invalid or incomplete schema, unknown type: Query. Ensure that a full introspection query is used in order to build a client schema.', ); }); @@ -555,8 +554,7 @@ describe('Type System: build schema from introspection', () => { delete queryTypeIntrospection.kind; expect(() => buildClientSchema(introspection)).to.throw( - 'Invalid or incomplete introspection result. Ensure that a full ' + - 'introspection query is used in order to build a client schema', + 'Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema', ); }); diff --git a/src/utilities/__tests__/extendSchema-test.js b/src/utilities/__tests__/extendSchema-test.js index ea399e0d41..6ad6b37d35 100644 --- a/src/utilities/__tests__/extendSchema-test.js +++ b/src/utilities/__tests__/extendSchema-test.js @@ -1094,8 +1094,7 @@ describe('extendSchema', () => { `; expect(() => extendTestSchema(sdl)).to.throw( - 'Directive "include" already exists in the schema. It cannot be ' + - 'redefined.', + 'Directive "include" already exists in the schema. It cannot be redefined.', ); }); @@ -1106,8 +1105,7 @@ describe('extendSchema', () => { } `; expect(() => extendTestSchema(sdl)).to.throw( - 'Enum value "SomeEnum.ONE" already exists in the schema. It cannot ' + - 'also be defined in this type extension.', + 'Enum value "SomeEnum.ONE" already exists in the schema. It cannot also be defined in this type extension.', ); }); diff --git a/src/validation/__tests__/FieldsOnCorrectType-test.js b/src/validation/__tests__/FieldsOnCorrectType-test.js index 62fbb1e08d..6ecfd412a0 100644 --- a/src/validation/__tests__/FieldsOnCorrectType-test.js +++ b/src/validation/__tests__/FieldsOnCorrectType-test.js @@ -244,8 +244,7 @@ describe('Validate: Fields on correct type', () => { it('Works with no small numbers of type suggestions', () => { expect(undefinedFieldMessage('f', 'T', ['A', 'B'], [])).to.equal( - 'Cannot query field "f" on type "T". ' + - 'Did you mean to use an inline fragment on "A" or "B"?', + 'Cannot query field "f" on type "T". Did you mean to use an inline fragment on "A" or "B"?', ); }); @@ -257,8 +256,7 @@ describe('Validate: Fields on correct type', () => { it('Only shows one set of suggestions at a time, preferring types', () => { expect(undefinedFieldMessage('f', 'T', ['A', 'B'], ['z', 'y'])).to.equal( - 'Cannot query field "f" on type "T". ' + - 'Did you mean to use an inline fragment on "A" or "B"?', + 'Cannot query field "f" on type "T". Did you mean to use an inline fragment on "A" or "B"?', ); }); @@ -266,8 +264,7 @@ describe('Validate: Fields on correct type', () => { expect( undefinedFieldMessage('f', 'T', ['A', 'B', 'C', 'D', 'E', 'F'], []), ).to.equal( - 'Cannot query field "f" on type "T". ' + - 'Did you mean to use an inline fragment on "A", "B", "C", "D", or "E"?', + 'Cannot query field "f" on type "T". Did you mean to use an inline fragment on "A", "B", "C", "D", or "E"?', ); }); @@ -275,8 +272,7 @@ describe('Validate: Fields on correct type', () => { expect( undefinedFieldMessage('f', 'T', [], ['z', 'y', 'x', 'w', 'v', 'u']), ).to.equal( - 'Cannot query field "f" on type "T". ' + - 'Did you mean "z", "y", "x", "w", or "v"?', + 'Cannot query field "f" on type "T". Did you mean "z", "y", "x", "w", or "v"?', ); }); }); diff --git a/src/validation/__tests__/OverlappingFieldsCanBeMerged-test.js b/src/validation/__tests__/OverlappingFieldsCanBeMerged-test.js index 193cc1de41..08901c6cde 100644 --- a/src/validation/__tests__/OverlappingFieldsCanBeMerged-test.js +++ b/src/validation/__tests__/OverlappingFieldsCanBeMerged-test.js @@ -965,8 +965,7 @@ describe('Validate: Overlapping fields can be merged', () => { // different aliases. const error = fieldsConflictMessage('x', 'a and b are different fields'); expect(error).to.equal( - 'Fields "x" conflict because a and b are different fields. Use ' + - 'different aliases on the fields to fetch both if this was intentional.', + 'Fields "x" conflict because a and b are different fields. Use different aliases on the fields to fetch both if this was intentional.', ); }); diff --git a/src/validation/__tests__/validation-test.js b/src/validation/__tests__/validation-test.js index fb3238d9fc..9d3a6c7d1a 100644 --- a/src/validation/__tests__/validation-test.js +++ b/src/validation/__tests__/validation-test.js @@ -45,8 +45,7 @@ describe('Validate: Supports full validation', () => { { locations: [{ line: 3, column: 25 }], message: - 'Expected type Invalid, found "bad value"; ' + - 'Invalid scalar is always invalid: "bad value"', + 'Expected type Invalid, found "bad value"; Invalid scalar is always invalid: "bad value"', }, ]); }); @@ -73,12 +72,9 @@ describe('Validate: Supports full validation', () => { const errorMessages = errors.map(err => err.message); expect(errorMessages).to.deep.equal([ - 'Cannot query field "catOrDog" on type "QueryRoot". ' + - 'Did you mean "catOrDog"?', - 'Cannot query field "furColor" on type "Cat". ' + - 'Did you mean "furColor"?', - 'Cannot query field "isHousetrained" on type "Dog". ' + - 'Did you mean "isHousetrained"?', + 'Cannot query field "catOrDog" on type "QueryRoot". Did you mean "catOrDog"?', + 'Cannot query field "furColor" on type "Cat". Did you mean "furColor"?', + 'Cannot query field "isHousetrained" on type "Dog". Did you mean "isHousetrained"?', ]); }); });