diff --git a/src/language/__tests__/printer-test.ts b/src/language/__tests__/printer-test.ts index 227e90dd44..73e760d696 100644 --- a/src/language/__tests__/printer-test.ts +++ b/src/language/__tests__/printer-test.ts @@ -66,10 +66,10 @@ describe('Printer: Query document', () => { it('prints query with variable directives', () => { const queryASTWithVariableDirective = parse( - 'query ($foo: TestType = {a: 123} @testDirective(if: true) @test) { id }', + 'query ($foo: TestType = { a: 123 } @testDirective(if: true) @test) { id }', ); expect(print(queryASTWithVariableDirective)).to.equal(dedent` - query ($foo: TestType = {a: 123} @testDirective(if: true) @test) { + query ($foo: TestType = { a: 123 } @testDirective(if: true) @test) { id } `); @@ -196,9 +196,9 @@ describe('Printer: Query document', () => { foo( size: $size bar: $b - obj: {key: "value", block: """ + obj: { key: "value", block: """ block string uses \""" - """} + """ } ) } diff --git a/src/language/__tests__/schema-printer-test.ts b/src/language/__tests__/schema-printer-test.ts index 49a32693ff..7272b2f2b8 100644 --- a/src/language/__tests__/schema-printer-test.ts +++ b/src/language/__tests__/schema-printer-test.ts @@ -59,7 +59,7 @@ describe('Printer: SDL document', () => { three(argument: InputType, other: String): Int four(argument: String = "string"): String five(argument: [String] = ["string", "string"]): String - six(argument: InputType = {key: "value"}): Type + six(argument: InputType = { key: "value" }): Type seven(argument: Int = null): Type } diff --git a/src/language/printer.ts b/src/language/printer.ts index e95c118d8b..38cb25444b 100644 --- a/src/language/printer.ts +++ b/src/language/printer.ts @@ -116,7 +116,7 @@ const printDocASTReducer: ASTReducer = { NullValue: { leave: () => 'null' }, EnumValue: { leave: ({ value }) => value }, ListValue: { leave: ({ values }) => '[' + join(values, ', ') + ']' }, - ObjectValue: { leave: ({ fields }) => '{' + join(fields, ', ') + '}' }, + ObjectValue: { leave: ({ fields }) => '{ ' + join(fields, ', ') + ' }' }, ObjectField: { leave: ({ name, value }) => name + ': ' + value }, // Directive diff --git a/src/type/__tests__/introspection-test.ts b/src/type/__tests__/introspection-test.ts index 741d9c0076..df431dafd3 100644 --- a/src/type/__tests__/introspection-test.ts +++ b/src/type/__tests__/introspection-test.ts @@ -1086,7 +1086,7 @@ describe('Introspection', () => { const schema = buildSchema(` input InputObjectWithDefaultValues { a: String = "Emoji: \\u{1F600}" - b: Complex = {x: ["abc"], y: 123} + b: Complex = { x: ["abc"], y: 123 } } input Complex { @@ -1120,7 +1120,7 @@ describe('Introspection', () => { }, { name: 'b', - defaultValue: '{x: ["abc"], y: 123}', + defaultValue: '{ x: ["abc"], y: 123 }', }, ], }, diff --git a/src/type/__tests__/scalars-test.ts b/src/type/__tests__/scalars-test.ts index 4d563aee10..eda64afa42 100644 --- a/src/type/__tests__/scalars-test.ts +++ b/src/type/__tests__/scalars-test.ts @@ -99,7 +99,7 @@ describe('Type System: Specified scalar types', () => { 'Int cannot represent non-integer value: [1]', ); expect(() => parseLiteral('{ value: 1 }')).to.throw( - 'Int cannot represent non-integer value: {value: 1}', + 'Int cannot represent non-integer value: { value: 1 }', ); expect(() => parseLiteral('ENUM_VALUE')).to.throw( 'Int cannot represent non-integer value: ENUM_VALUE', @@ -259,7 +259,7 @@ describe('Type System: Specified scalar types', () => { 'Float cannot represent non numeric value: [0.1]', ); expect(() => parseLiteral('{ value: 0.1 }')).to.throw( - 'Float cannot represent non numeric value: {value: 0.1}', + 'Float cannot represent non numeric value: { value: 0.1 }', ); expect(() => parseLiteral('ENUM_VALUE')).to.throw( 'Float cannot represent non numeric value: ENUM_VALUE', @@ -366,7 +366,7 @@ describe('Type System: Specified scalar types', () => { 'String cannot represent a non string value: ["foo"]', ); expect(() => parseLiteral('{ value: "foo" }')).to.throw( - 'String cannot represent a non string value: {value: "foo"}', + 'String cannot represent a non string value: { value: "foo" }', ); expect(() => parseLiteral('ENUM_VALUE')).to.throw( 'String cannot represent a non string value: ENUM_VALUE', @@ -484,7 +484,7 @@ describe('Type System: Specified scalar types', () => { 'Boolean cannot represent a non boolean value: [false]', ); expect(() => parseLiteral('{ value: false }')).to.throw( - 'Boolean cannot represent a non boolean value: {value: false}', + 'Boolean cannot represent a non boolean value: { value: false }', ); expect(() => parseLiteral('ENUM_VALUE')).to.throw( 'Boolean cannot represent a non boolean value: ENUM_VALUE', @@ -599,7 +599,7 @@ describe('Type System: Specified scalar types', () => { 'ID cannot represent a non-string and non-integer value: ["1"]', ); expect(() => parseLiteral('{ value: "1" }')).to.throw( - 'ID cannot represent a non-string and non-integer value: {value: "1"}', + 'ID cannot represent a non-string and non-integer value: { value: "1" }', ); expect(() => parseLiteral('ENUM_VALUE')).to.throw( 'ID cannot represent a non-string and non-integer value: ENUM_VALUE', diff --git a/src/utilities/__tests__/buildClientSchema-test.ts b/src/utilities/__tests__/buildClientSchema-test.ts index 7d17811515..b50cdf66c3 100644 --- a/src/utilities/__tests__/buildClientSchema-test.ts +++ b/src/utilities/__tests__/buildClientSchema-test.ts @@ -443,7 +443,7 @@ describe('Type System: build schema from introspection', () => { type Query { defaultInt(intArg: Int = 30): String defaultList(listArg: [Int] = [1, 2, 3]): String - defaultObject(objArg: Geo = {lat: 37.485, lon: -122.148}): String + defaultObject(objArg: Geo = { lat: 37.485, lon: -122.148 }): String defaultNull(intArg: Int = null): String noDefault(intArg: Int): String } diff --git a/src/utilities/__tests__/findBreakingChanges-test.ts b/src/utilities/__tests__/findBreakingChanges-test.ts index 5a7956ae5d..6c26e24ad0 100644 --- a/src/utilities/__tests__/findBreakingChanges-test.ts +++ b/src/utilities/__tests__/findBreakingChanges-test.ts @@ -961,7 +961,7 @@ describe('findDangerousChanges', () => { { type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, description: - 'Type1.field1 arg complexObject has changed defaultValue from {innerInputArray: [{arrayField: [1, 2, 3]}]} to {innerInputArray: [{arrayField: [3, 2, 1]}]}.', + 'Type1.field1 arg complexObject has changed defaultValue from { innerInputArray: [{ arrayField: [1, 2, 3] }] } to { innerInputArray: [{ arrayField: [3, 2, 1] }] }.', }, ]); }); diff --git a/src/utilities/__tests__/sortValueNode-test.ts b/src/utilities/__tests__/sortValueNode-test.ts index 5bda137d14..c55a9be912 100644 --- a/src/utilities/__tests__/sortValueNode-test.ts +++ b/src/utilities/__tests__/sortValueNode-test.ts @@ -28,13 +28,15 @@ describe('sortValueNode', () => { }); it('sort input object fields', () => { - expectSortedValue('{ b: 2, a: 1 }').to.equal('{a: 1, b: 2}'); - expectSortedValue('{ a: { c: 3, b: 2 } }').to.equal('{a: {b: 2, c: 3}}'); - expectSortedValue('[{ b: 2, a: 1 }, { d: 4, c: 3}]').to.equal( - '[{a: 1, b: 2}, {c: 3, d: 4}]', + expectSortedValue('{ b: 2, a: 1 }').to.equal('{ a: 1, b: 2 }'); + expectSortedValue('{ a: { c: 3, b: 2 } }').to.equal( + '{ a: { b: 2, c: 3 } }', + ); + expectSortedValue('[{ b: 2, a: 1 }, { d: 4, c: 3 }]').to.equal( + '[{ a: 1, b: 2 }, { c: 3, d: 4 }]', ); expectSortedValue( '{ b: { g: 7, f: 6 }, c: 3 , a: { d: 4, e: 5 } }', - ).to.equal('{a: {d: 4, e: 5}, b: {f: 6, g: 7}, c: 3}'); + ).to.equal('{ a: { d: 4, e: 5 }, b: { f: 6, g: 7 }, c: 3 }'); }); });