Skip to content

Commit baba0a5

Browse files
committed
validation-test: Test root type validation with multiple types
Extracted from graphql#3453 All credits goes to @thomasheyenbrock
1 parent 839f244 commit baba0a5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/type/__tests__/validation-test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,12 @@ describe('Type System: A Schema must have Object root types', () => {
341341
input SomeInputObject {
342342
test: String
343343
}
344+
345+
scalar SomeScalar
346+
347+
enum SomeEnum {
348+
ENUM_VALUE
349+
}
344350
`);
345351

346352
schema = extendSchema(
@@ -356,7 +362,7 @@ describe('Type System: A Schema must have Object root types', () => {
356362
schema,
357363
parse(`
358364
extend schema {
359-
mutation: SomeInputObject
365+
mutation: SomeScalar
360366
}
361367
`),
362368
);
@@ -365,7 +371,7 @@ describe('Type System: A Schema must have Object root types', () => {
365371
schema,
366372
parse(`
367373
extend schema {
368-
subscription: SomeInputObject
374+
subscription: SomeEnum
369375
}
370376
`),
371377
);
@@ -378,12 +384,12 @@ describe('Type System: A Schema must have Object root types', () => {
378384
},
379385
{
380386
message:
381-
'Mutation root type must be Object type if provided, it cannot be SomeInputObject.',
387+
'Mutation root type must be Object type if provided, it cannot be SomeScalar.',
382388
locations: [{ line: 3, column: 21 }],
383389
},
384390
{
385391
message:
386-
'Subscription root type must be Object type if provided, it cannot be SomeInputObject.',
392+
'Subscription root type must be Object type if provided, it cannot be SomeEnum.',
387393
locations: [{ line: 3, column: 25 }],
388394
},
389395
]);

0 commit comments

Comments
 (0)