Skip to content

Commit 0eb070f

Browse files
excitement-engineerleebyron
authored andcommitted
Expanded findBreakingChanges test with missing case. (#993)
1 parent 0779c36 commit 0eb070f

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

src/utilities/__tests__/findBreakingChanges-test.js

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,36 @@ describe('findBreakingChanges', () => {
12141214
}
12151215
});
12161216

1217+
const interface1 = new GraphQLInterfaceType({
1218+
name: 'Interface1',
1219+
fields: {
1220+
field1: { type: GraphQLString },
1221+
},
1222+
resolveType: () => null,
1223+
});
1224+
1225+
const typeThatLosesInterfaceOld = new GraphQLObjectType({
1226+
name: 'TypeThatGainsInterface1',
1227+
interfaces: [
1228+
interface1
1229+
],
1230+
fields: {
1231+
field1: {
1232+
type: GraphQLString,
1233+
},
1234+
},
1235+
});
1236+
1237+
const typeThaLosesInterfaceNew = new GraphQLObjectType({
1238+
name: 'TypeThatGainsInterface1',
1239+
interfaces: [],
1240+
fields: {
1241+
field1: {
1242+
type: GraphQLString,
1243+
},
1244+
},
1245+
});
1246+
12171247
const oldSchema = new GraphQLSchema({
12181248
query: queryType,
12191249
types: [
@@ -1222,7 +1252,8 @@ describe('findBreakingChanges', () => {
12221252
typeThatHasBreakingFieldChangesOld,
12231253
unionTypeThatLosesATypeOld,
12241254
enumTypeThatLosesAValueOld,
1225-
argThatChanges
1255+
argThatChanges,
1256+
typeThatLosesInterfaceOld
12261257
]
12271258
});
12281259

@@ -1234,6 +1265,8 @@ describe('findBreakingChanges', () => {
12341265
unionTypeThatLosesATypeNew,
12351266
enumTypeThatLosesAValueNew,
12361267
argChanged,
1268+
typeThaLosesInterfaceNew,
1269+
interface1
12371270
]
12381271
});
12391272

@@ -1279,6 +1312,11 @@ describe('findBreakingChanges', () => {
12791312
description: 'ArgThatChanges.field1 arg id has changed ' +
12801313
'type from Int to String',
12811314
},
1315+
{
1316+
type: BreakingChangeType.INTERFACE_REMOVED_FROM_OBJECT,
1317+
description: 'TypeThatGainsInterface1 no longer implements ' +
1318+
'interface Interface1.',
1319+
}
12821320
];
12831321
expect(findBreakingChanges(oldSchema, newSchema)).to.eql(
12841322
expectedBreakingChanges

0 commit comments

Comments
 (0)