@@ -1040,6 +1040,13 @@ describe('extendSchema', () => {
10401040 ` ;
10411041 expect ( ( ) => extendTestSchema ( typeSDL ) ) . to . throw ( existingTypeError ( 'Bar' ) ) ;
10421042
1043+ const scalarSDL = `
1044+ scalar SomeScalar
1045+ ` ;
1046+ expect ( ( ) => extendTestSchema ( scalarSDL ) ) . to . throw (
1047+ existingTypeError ( 'SomeScalar' ) ,
1048+ ) ;
1049+
10431050 const interfaceSDL = `
10441051 interface SomeInterface
10451052 ` ;
@@ -1147,34 +1154,18 @@ describe('extendSchema', () => {
11471154 } ) ;
11481155
11491156 it ( 'does not allow extending an unknown type' , ( ) => {
1150- const unknownTypeError =
1151- 'Cannot extend type "UnknownType" because it does not exist in the ' +
1152- 'existing schema.' ;
1153-
1154- const typeSDL = `
1155- extend type UnknownType @foo
1156- ` ;
1157- expect ( ( ) => extendTestSchema ( typeSDL ) ) . to . throw ( unknownTypeError ) ;
1158-
1159- const intefaceSDL = `
1160- extend interface UnknownType @foo
1161- ` ;
1162- expect ( ( ) => extendTestSchema ( intefaceSDL ) ) . to . throw ( unknownTypeError ) ;
1163-
1164- const enumSDL = `
1165- extend enum UnknownType @foo
1166- ` ;
1167- expect ( ( ) => extendTestSchema ( enumSDL ) ) . to . throw ( unknownTypeError ) ;
1168-
1169- const unionSDL = `
1170- extend union UnknownType @foo
1171- ` ;
1172- expect ( ( ) => extendTestSchema ( unionSDL ) ) . to . throw ( unknownTypeError ) ;
1173-
1174- const inputSDL = `
1175- extend input UnknownType @foo
1176- ` ;
1177- expect ( ( ) => extendTestSchema ( inputSDL ) ) . to . throw ( unknownTypeError ) ;
1157+ [
1158+ 'extend scalar UnknownType @foo' ,
1159+ 'extend type UnknownType @foo' ,
1160+ 'extend interface UnknownType @foo' ,
1161+ 'extend enum UnknownType @foo' ,
1162+ 'extend union UnknownType @foo' ,
1163+ 'extend input UnknownType @foo' ,
1164+ ] . forEach ( sdl => {
1165+ expect ( ( ) => extendTestSchema ( sdl ) ) . to . throw (
1166+ 'Cannot extend type "UnknownType" because it does not exist in the existing schema.' ,
1167+ ) ;
1168+ } ) ;
11781169 } ) ;
11791170
11801171 it ( 'maintains configuration of the original schema object' , ( ) => {
0 commit comments