Skip to content

Commit

Permalink
Merge pull request #889 from tberman/master
Browse files Browse the repository at this point in the history
Sort fields before printing to get a more stable diff
  • Loading branch information
wincent authored May 30, 2017
2 parents 94a591f + 870967a commit f5dd099
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 74 deletions.
2 changes: 1 addition & 1 deletion src/subscription/__tests__/subscribe-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ describe('Subscribe', () => {
invalidEmailSchema,
ast
);
}).to.throw('Subscription must return AsyncIterable. Received: test');
}).to.throw('Subscription must return Async Iterable. Received: test');
});

it('expects to have subscribe on type definition with iterator', () => {
Expand Down
28 changes: 14 additions & 14 deletions src/utilities/__tests__/buildASTSchema-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ schema {
}
type HelloScalars {
str: String
int: Int
bool: Boolean
float: Float
id: ID
bool: Boolean
int: Int
str: String
}
`;
const output = cycleOutput(body);
Expand Down Expand Up @@ -196,11 +196,11 @@ schema {
}
type HelloScalars {
nonNullStr: String!
listOfStrs: [String]
listOfNonNullStrs: [String!]
nonNullListOfStrs: [String]!
listOfStrs: [String]
nonNullListOfNonNullStrs: [String!]!
nonNullListOfStrs: [String]!
nonNullStr: String!
}
`;
const output = cycleOutput(body);
Expand All @@ -215,8 +215,8 @@ schema {
}
type Recurse {
str: String
recurse: Recurse
str: String
}
`;
const output = cycleOutput(body);
Expand Down Expand Up @@ -250,10 +250,10 @@ schema {
}
type Hello {
str(int: Int): String
booleanToStr(bool: Boolean): String
floatToStr(float: Float): String
idToStr(id: ID): String
booleanToStr(bool: Boolean): String
str(int: Int): String
strToStr(bool: String): String
}
`;
Expand Down Expand Up @@ -450,9 +450,9 @@ schema {
}
type HelloScalars {
str: String
int: Int
bool: Boolean
int: Int
str: String
}
type Mutation {
Expand All @@ -471,9 +471,9 @@ schema {
}
type HelloScalars {
str: String
int: Int
bool: Boolean
int: Int
str: String
}
type Subscription {
Expand Down Expand Up @@ -527,9 +527,9 @@ enum MyEnum {
}
type Query {
enum: MyEnum
field1: String @deprecated
field2: Int @deprecated(reason: "Because I said so")
enum: MyEnum
}
`;
const output = cycleOutput(body);
Expand Down
58 changes: 29 additions & 29 deletions src/utilities/__tests__/extendSchema-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ describe('extendSchema', () => {
expect(printSchema(testSchema)).to.equal(originalPrint);
expect(printSchema(extendedSchema)).to.equal(
`type Bar implements SomeInterface {
foo: Foo
name: String
some: SomeInterface
foo: Foo
}
type Biz {
Expand All @@ -169,16 +169,16 @@ type Biz {
type Foo implements SomeInterface {
name: String
newField: String
some: SomeInterface
tree: [Foo]!
newField: String
}
type Query {
foo: Foo
someUnion: SomeUnion
someEnum: SomeEnum
someInterface(id: ID!): SomeInterface
someUnion: SomeUnion
}
enum SomeEnum {
Expand Down Expand Up @@ -251,9 +251,9 @@ union SomeUnion = Foo | Biz
expect(printSchema(testSchema)).to.equal(originalPrint);
expect(printSchema(extendedSchema)).to.equal(
`type Bar implements SomeInterface {
foo: Foo
name: String
some: SomeInterface
foo: Foo
}
type Biz {
Expand All @@ -268,9 +268,9 @@ type Foo implements SomeInterface {
type Query {
foo: Foo
someUnion: SomeUnion
someEnum: SomeEnum
someInterface(id: ID!): SomeInterface
someUnion: SomeUnion
}
enum SomeEnum {
Expand Down Expand Up @@ -309,9 +309,9 @@ type Unused {
expect(printSchema(testSchema)).to.equal(originalPrint);
expect(printSchema(extendedSchema)).to.equal(
`type Bar implements SomeInterface {
foo: Foo
name: String
some: SomeInterface
foo: Foo
}
type Biz {
Expand All @@ -320,9 +320,9 @@ type Biz {
type Foo implements SomeInterface {
name: String
newField(arg1: String, arg2: NewInputObj!): String
some: SomeInterface
tree: [Foo]!
newField(arg1: String, arg2: NewInputObj!): String
}
input NewInputObj {
Expand All @@ -333,9 +333,9 @@ input NewInputObj {
type Query {
foo: Foo
someUnion: SomeUnion
someEnum: SomeEnum
someInterface(id: ID!): SomeInterface
someUnion: SomeUnion
}
enum SomeEnum {
Expand Down Expand Up @@ -364,9 +364,9 @@ union SomeUnion = Foo | Biz
expect(printSchema(testSchema)).to.equal(originalPrint);
expect(printSchema(extendedSchema)).to.equal(
`type Bar implements SomeInterface {
foo: Foo
name: String
some: SomeInterface
foo: Foo
}
type Biz {
Expand All @@ -375,16 +375,16 @@ type Biz {
type Foo implements SomeInterface {
name: String
newField(arg1: SomeEnum!): SomeEnum
some: SomeInterface
tree: [Foo]!
newField(arg1: SomeEnum!): SomeEnum
}
type Query {
foo: Foo
someUnion: SomeUnion
someEnum: SomeEnum
someInterface(id: ID!): SomeInterface
someUnion: SomeUnion
}
enum SomeEnum {
Expand Down Expand Up @@ -414,9 +414,9 @@ union SomeUnion = Foo | Biz
expect(printSchema(testSchema)).to.equal(originalPrint);
expect(printSchema(extendedSchema)).to.equal(
`type Bar implements SomeInterface {
foo: Foo
name: String
some: SomeInterface
foo: Foo
}
type Biz implements SomeInterface {
Expand All @@ -433,9 +433,9 @@ type Foo implements SomeInterface {
type Query {
foo: Foo
someUnion: SomeUnion
someEnum: SomeEnum
someInterface(id: ID!): SomeInterface
someUnion: SomeUnion
}
enum SomeEnum {
Expand Down Expand Up @@ -490,9 +490,9 @@ union SomeUnion = Foo | Biz
expect(printSchema(testSchema)).to.equal(originalPrint);
expect(printSchema(extendedSchema)).to.equal(
`type Bar implements SomeInterface {
foo: Foo
name: String
some: SomeInterface
foo: Foo
}
type Biz {
Expand All @@ -501,14 +501,14 @@ type Biz {
type Foo implements SomeInterface {
name: String
some: SomeInterface
tree: [Foo]!
newObject: NewObject
newEnum: NewEnum
newInterface: NewInterface
newUnion: NewUnion
newObject: NewObject
newScalar: NewScalar
newEnum: NewEnum
newTree: [Foo]!
newUnion: NewUnion
some: SomeInterface
tree: [Foo]!
}
enum NewEnum {
Expand All @@ -534,9 +534,9 @@ union NewUnion = NewObject | NewOtherObject
type Query {
foo: Foo
someUnion: SomeUnion
someEnum: SomeEnum
someInterface(id: ID!): SomeInterface
someUnion: SomeUnion
}
enum SomeEnum {
Expand Down Expand Up @@ -569,20 +569,20 @@ union SomeUnion = Foo | Biz
expect(printSchema(testSchema)).to.equal(originalPrint);
expect(printSchema(extendedSchema)).to.equal(
`type Bar implements SomeInterface {
foo: Foo
name: String
some: SomeInterface
foo: Foo
}
type Biz {
fizz: String
}
type Foo implements SomeInterface, NewInterface {
baz: String
name: String
some: SomeInterface
tree: [Foo]!
baz: String
}
interface NewInterface {
Expand All @@ -591,9 +591,9 @@ interface NewInterface {
type Query {
foo: Foo
someUnion: SomeUnion
someEnum: SomeEnum
someInterface(id: ID!): SomeInterface
someUnion: SomeUnion
}
enum SomeEnum {
Expand Down Expand Up @@ -637,18 +637,18 @@ union SomeUnion = Foo | Biz
expect(printSchema(testSchema)).to.equal(originalPrint);
expect(printSchema(extendedSchema)).to.equal(
`type Bar implements SomeInterface {
foo: Foo
name: String
some: SomeInterface
foo: Foo
}
type Biz implements NewInterface, SomeInterface {
fizz: String
buzz: String
fizz: String
name: String
some: SomeInterface
newFieldA: Int
newFieldB: Float
some: SomeInterface
}
type Foo implements SomeInterface {
Expand All @@ -663,9 +663,9 @@ interface NewInterface {
type Query {
foo: Foo
someUnion: SomeUnion
someEnum: SomeEnum
someInterface(id: ID!): SomeInterface
someUnion: SomeUnion
}
enum SomeEnum {
Expand Down Expand Up @@ -728,13 +728,13 @@ union SomeUnion = Foo | Biz
}
type Query {
queryField: String
newQueryField: Int
queryField: String
}
type Subscription {
subscriptionField: String
newSubscriptionField: Int
subscriptionField: String
}
`);
});
Expand Down
Loading

0 comments on commit f5dd099

Please sign in to comment.