@@ -154,50 +154,98 @@ describe('findBreakingChanges', () => {
154
154
type : BreakingChangeType . FIELD_CHANGED_KIND ,
155
155
description : 'Type1.field3 changed type from String to Boolean.' ,
156
156
} ) ;
157
+ // $FlowFixMe
158
+ expect ( changes [ 1 ] . oldNode . type . name . value ) . to . equal ( 'String' ) ;
159
+ // $FlowFixMe
160
+ expect ( changes [ 1 ] . newNode . type . name . value ) . to . equal ( 'Boolean' ) ;
157
161
expect ( changes [ 2 ] ) . to . deep . include ( {
158
162
type : BreakingChangeType . FIELD_CHANGED_KIND ,
159
163
description : 'Type1.field4 changed type from TypeA to TypeB.' ,
160
164
} ) ;
165
+ // $FlowFixMe
166
+ expect ( changes [ 2 ] . oldNode . type . name . value ) . to . equal ( 'TypeA' ) ;
167
+ // $FlowFixMe
168
+ expect ( changes [ 2 ] . newNode . type . name . value ) . to . equal ( 'TypeB' ) ;
161
169
expect ( changes [ 3 ] ) . to . deep . include ( {
162
170
type : BreakingChangeType . FIELD_CHANGED_KIND ,
163
171
description : 'Type1.field6 changed type from String to [String].' ,
164
172
} ) ;
173
+ // $FlowFixMe
174
+ expect ( changes [ 3 ] . oldNode . type . name . value ) . to . equal ( 'String' ) ;
175
+ // $FlowFixMe
176
+ expect ( changes [ 3 ] . newNode . type . kind ) . to . equal ( 'ListType' ) ;
165
177
expect ( changes [ 4 ] ) . to . deep . include ( {
166
178
type : BreakingChangeType . FIELD_CHANGED_KIND ,
167
179
description : 'Type1.field7 changed type from [String] to String.' ,
168
180
} ) ;
181
+ // $FlowFixMe
182
+ expect ( changes [ 4 ] . oldNode . type . kind ) . to . equal ( 'ListType' ) ;
183
+ // $FlowFixMe
184
+ expect ( changes [ 4 ] . newNode . type . name . value ) . to . equal ( 'String' ) ;
169
185
expect ( changes [ 5 ] ) . to . deep . include ( {
170
186
type : BreakingChangeType . FIELD_CHANGED_KIND ,
171
187
description : 'Type1.field9 changed type from Int! to Int.' ,
172
188
} ) ;
189
+ // $FlowFixMe
190
+ expect ( changes [ 5 ] . oldNode . type . kind ) . to . equal ( 'NonNullType' ) ;
191
+ // $FlowFixMe
192
+ expect ( changes [ 5 ] . newNode . type . name . value ) . to . equal ( 'Int' ) ;
173
193
expect ( changes [ 6 ] ) . to . deep . include ( {
174
194
type : BreakingChangeType . FIELD_CHANGED_KIND ,
175
195
description : 'Type1.field10 changed type from [Int]! to [Int].' ,
176
196
} ) ;
197
+ // $FlowFixMe
198
+ expect ( changes [ 6 ] . oldNode . type . kind ) . to . equal ( 'NonNullType' ) ;
199
+ // $FlowFixMe
200
+ expect ( changes [ 6 ] . newNode . type . kind ) . to . equal ( 'ListType' ) ;
177
201
expect ( changes [ 7 ] ) . to . deep . include ( {
178
202
type : BreakingChangeType . FIELD_CHANGED_KIND ,
179
203
description : 'Type1.field11 changed type from Int to [Int]!.' ,
180
204
} ) ;
205
+ // $FlowFixMe
206
+ expect ( changes [ 7 ] . oldNode . type . name . value ) . to . equal ( 'Int' ) ;
207
+ // $FlowFixMe
208
+ expect ( changes [ 7 ] . newNode . type . kind ) . to . equal ( 'NonNullType' ) ;
181
209
expect ( changes [ 8 ] ) . to . deep . include ( {
182
210
type : BreakingChangeType . FIELD_CHANGED_KIND ,
183
211
description : 'Type1.field13 changed type from [Int!] to [Int].' ,
184
212
} ) ;
213
+ // $FlowFixMe
214
+ expect ( changes [ 8 ] . oldNode . type . type . kind ) . to . equal ( 'NonNullType' ) ;
215
+ // $FlowFixMe
216
+ expect ( changes [ 8 ] . newNode . type . kind ) . to . equal ( 'ListType' ) ;
185
217
expect ( changes [ 9 ] ) . to . deep . include ( {
186
218
type : BreakingChangeType . FIELD_CHANGED_KIND ,
187
219
description : 'Type1.field14 changed type from [Int] to [[Int]].' ,
188
220
} ) ;
221
+ // $FlowFixMe
222
+ expect ( changes [ 9 ] . oldNode . type . type . name . value ) . to . equal ( 'Int' ) ;
223
+ // $FlowFixMe
224
+ expect ( changes [ 9 ] . newNode . type . type . kind ) . to . equal ( 'ListType' ) ;
189
225
expect ( changes [ 10 ] ) . to . deep . include ( {
190
226
type : BreakingChangeType . FIELD_CHANGED_KIND ,
191
227
description : 'Type1.field15 changed type from [[Int]] to [Int].' ,
192
228
} ) ;
229
+ // $FlowFixMe
230
+ expect ( changes [ 10 ] . oldNode . type . type . kind ) . to . equal ( 'ListType' ) ;
231
+ // $FlowFixMe
232
+ expect ( changes [ 10 ] . newNode . type . type . name . value ) . to . equal ( 'Int' ) ;
193
233
expect ( changes [ 11 ] ) . to . deep . include ( {
194
234
type : BreakingChangeType . FIELD_CHANGED_KIND ,
195
235
description : 'Type1.field16 changed type from Int! to [Int]!.' ,
196
236
} ) ;
237
+ // $FlowFixMe
238
+ expect ( changes [ 11 ] . oldNode . type . type . name . value ) . to . equal ( 'Int' ) ;
239
+ // $FlowFixMe
240
+ expect ( changes [ 11 ] . newNode . type . type . kind ) . to . equal ( 'ListType' ) ;
197
241
expect ( changes [ 12 ] ) . to . deep . include ( {
198
242
type : BreakingChangeType . FIELD_CHANGED_KIND ,
199
243
description : 'Type1.field18 changed type from [[Int!]!] to [[Int!]].' ,
200
244
} ) ;
245
+ // $FlowFixMe
246
+ expect ( changes [ 12 ] . oldNode . type . type . kind ) . to . equal ( 'NonNullType' ) ;
247
+ // $FlowFixMe
248
+ expect ( changes [ 12 ] . newNode . type . type . kind ) . to . equal ( 'ListType' ) ;
201
249
} ) ;
202
250
203
251
it ( 'should detect if fields on input types changed kind or were removed' , ( ) => {
@@ -245,6 +293,10 @@ describe('findBreakingChanges', () => {
245
293
type : BreakingChangeType . FIELD_CHANGED_KIND ,
246
294
description : 'InputType1.field1 changed type from String to Int.' ,
247
295
} ) ;
296
+ // $FlowFixMe
297
+ expect ( changes [ 0 ] . oldNode . type . name . value ) . to . equal ( 'String' ) ;
298
+ // $FlowFixMe
299
+ expect ( changes [ 0 ] . newNode . type . name . value ) . to . equal ( 'Int' ) ;
248
300
expect ( changes [ 1 ] ) . to . deep . include ( {
249
301
type : BreakingChangeType . FIELD_REMOVED ,
250
302
description : 'InputType1.field2 was removed.' ,
@@ -256,39 +308,77 @@ describe('findBreakingChanges', () => {
256
308
type : BreakingChangeType . FIELD_CHANGED_KIND ,
257
309
description : 'InputType1.field3 changed type from [String] to String.' ,
258
310
} ) ;
311
+ // $FlowFixMe
312
+ expect ( changes [ 2 ] . oldNode . type . kind ) . to . equal ( 'ListType' ) ;
313
+ // $FlowFixMe
314
+ expect ( changes [ 2 ] . newNode . type . name . value ) . to . equal ( 'String' ) ;
259
315
expect ( changes [ 3 ] ) . to . deep . include ( {
260
316
type : BreakingChangeType . FIELD_CHANGED_KIND ,
261
317
description : 'InputType1.field5 changed type from String to String!.' ,
262
318
} ) ;
319
+ // $FlowFixMe
320
+ expect ( changes [ 3 ] . oldNode . type . name . value ) . to . equal ( 'String' ) ;
321
+ // $FlowFixMe
322
+ expect ( changes [ 3 ] . newNode . type . kind ) . to . equal ( 'NonNullType' ) ;
263
323
expect ( changes [ 4 ] ) . to . deep . include ( {
264
324
type : BreakingChangeType . FIELD_CHANGED_KIND ,
265
325
description : 'InputType1.field6 changed type from [Int] to [Int]!.' ,
266
326
} ) ;
327
+ // $FlowFixMe
328
+ expect ( changes [ 4 ] . oldNode . type . kind ) . to . equal ( 'ListType' ) ;
329
+ // $FlowFixMe
330
+ expect ( changes [ 4 ] . newNode . type . kind ) . to . equal ( 'NonNullType' ) ;
267
331
expect ( changes [ 5 ] ) . to . deep . include ( {
268
332
type : BreakingChangeType . FIELD_CHANGED_KIND ,
269
333
description : 'InputType1.field8 changed type from Int to [Int]!.' ,
270
334
} ) ;
335
+ // $FlowFixMe
336
+ expect ( changes [ 5 ] . oldNode . type . name . value ) . to . equal ( 'Int' ) ;
337
+ // $FlowFixMe
338
+ expect ( changes [ 5 ] . newNode . type . kind ) . to . equal ( 'NonNullType' ) ;
271
339
expect ( changes [ 6 ] ) . to . deep . include ( {
272
340
type : BreakingChangeType . FIELD_CHANGED_KIND ,
273
341
description : 'InputType1.field9 changed type from [Int] to [Int!].' ,
274
342
} ) ;
343
+ // $FlowFixMe
344
+ expect ( changes [ 6 ] . oldNode . type . type . name . value ) . to . equal ( 'Int' ) ;
345
+ // $FlowFixMe
346
+ expect ( changes [ 6 ] . newNode . type . type . kind ) . to . equal ( 'NonNullType' ) ;
275
347
expect ( changes [ 7 ] ) . to . deep . include ( {
276
348
type : BreakingChangeType . FIELD_CHANGED_KIND ,
277
349
description : 'InputType1.field11 changed type from [Int] to [[Int]].' ,
278
350
} ) ;
351
+ // $FlowFixMe
352
+ expect ( changes [ 7 ] . oldNode . type . type . name . value ) . to . equal ( 'Int' ) ;
353
+ // $FlowFixMe
354
+ expect ( changes [ 7 ] . newNode . type . type . kind ) . to . equal ( 'ListType' ) ;
279
355
expect ( changes [ 8 ] ) . to . deep . include ( {
280
356
type : BreakingChangeType . FIELD_CHANGED_KIND ,
281
357
description : 'InputType1.field12 changed type from [[Int]] to [Int].' ,
282
358
} ) ;
359
+ // $FlowFixMe
360
+ expect ( changes [ 8 ] . oldNode . type . type . kind ) . to . equal ( 'ListType' ) ;
361
+ // $FlowFixMe
362
+ expect ( changes [ 8 ] . newNode . type . type . name . value ) . to . equal ( 'Int' ) ;
283
363
expect ( changes [ 9 ] ) . to . deep . include ( {
284
364
type : BreakingChangeType . FIELD_CHANGED_KIND ,
285
365
description : 'InputType1.field13 changed type from Int! to [Int]!.' ,
286
366
} ) ;
367
+ // $FlowFixMe
368
+ expect ( changes [ 9 ] . oldNode . type . type . name . value ) . to . equal ( 'Int' ) ;
369
+ // $FlowFixMe
370
+ expect ( changes [ 9 ] . newNode . type . type . kind ) . to . equal ( 'ListType' ) ;
287
371
expect ( changes [ 10 ] ) . to . deep . include ( {
288
372
type : BreakingChangeType . FIELD_CHANGED_KIND ,
289
373
description :
290
374
'InputType1.field15 changed type from [[Int]!] to [[Int!]!].' ,
291
375
} ) ;
376
+ // $FlowFixMe
377
+ expect ( changes [ 10 ] . oldNode . type . type . type . type . name . value ) . to . equal ( 'Int' ) ;
378
+ // $FlowFixMe
379
+ expect ( changes [ 10 ] . newNode . type . type . type . type . kind ) . to . equal (
380
+ 'NonNullType' ,
381
+ ) ;
292
382
} ) ;
293
383
294
384
it ( 'should detect if a required field is added to an input type' , ( ) => {
@@ -591,7 +681,8 @@ describe('findBreakingChanges', () => {
591
681
type : BreakingChangeType . REQUIRED_ARG_ADDED ,
592
682
description : 'A required arg newRequiredArg on Type1.field1 was added' ,
593
683
} ) ;
594
- expect ( changes [ 0 ] ) . to . have . property ( 'newNode' ) ;
684
+ // $FlowFixMe
685
+ expect ( changes [ 0 ] . newNode . name . value ) . to . equal ( 'newRequiredArg' ) ;
595
686
expect ( changes [ 0 ] ) . not . to . have . property ( 'oldNode' ) ;
596
687
} ) ;
597
688
@@ -770,6 +861,10 @@ describe('findBreakingChanges', () => {
770
861
description :
771
862
'TypeThatHasBreakingFieldChanges.field2 changed type from String to Boolean.' ,
772
863
} ) ;
864
+ // $FlowFixMe
865
+ expect ( changes [ 4 ] . oldNode . type . name . value ) . to . equal ( 'String' ) ;
866
+ // $FlowFixMe
867
+ expect ( changes [ 4 ] . newNode . type . name . value ) . to . equal ( 'Boolean' ) ;
773
868
expect ( changes [ 5 ] ) . to . deep . include ( {
774
869
type : BreakingChangeType . TYPE_REMOVED_FROM_UNION ,
775
870
description :
0 commit comments