@@ -1040,6 +1040,13 @@ describe('extendSchema', () => {
1040
1040
` ;
1041
1041
expect ( ( ) => extendTestSchema ( typeSDL ) ) . to . throw ( existingTypeError ( 'Bar' ) ) ;
1042
1042
1043
+ const scalarSDL = `
1044
+ scalar SomeScalar
1045
+ ` ;
1046
+ expect ( ( ) => extendTestSchema ( scalarSDL ) ) . to . throw (
1047
+ existingTypeError ( 'SomeScalar' ) ,
1048
+ ) ;
1049
+
1043
1050
const interfaceSDL = `
1044
1051
interface SomeInterface
1045
1052
` ;
@@ -1147,34 +1154,18 @@ describe('extendSchema', () => {
1147
1154
} ) ;
1148
1155
1149
1156
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
+ } ) ;
1178
1169
} ) ;
1179
1170
1180
1171
it ( 'maintains configuration of the original schema object' , ( ) => {
0 commit comments