Skip to content

Commit 516132a

Browse files
findBreakingChanges: merge funcs and remove duplicated iteration logic (#1911)
1 parent 7e15905 commit 516132a

File tree

2 files changed

+202
-276
lines changed

2 files changed

+202
-276
lines changed

src/utilities/__tests__/findBreakingChanges-test.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -676,38 +676,38 @@ describe('findBreakingChanges', () => {
676676
description: 'TypeThatGetsRemoved was removed.',
677677
},
678678
{
679-
type: BreakingChangeType.TYPE_CHANGED_KIND,
679+
type: BreakingChangeType.ARG_CHANGED_KIND,
680680
description:
681-
'TypeThatChangesType changed from an Object type to an Interface type.',
681+
'ArgThatChanges.field1 arg id has changed type from Int to String.',
682682
},
683683
{
684-
type: BreakingChangeType.FIELD_REMOVED,
685-
description: 'TypeThatHasBreakingFieldChanges.field1 was removed.',
684+
type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,
685+
description:
686+
'VALUE0 was removed from enum type EnumTypeThatLosesAValue.',
686687
},
687688
{
688-
type: BreakingChangeType.FIELD_CHANGED_KIND,
689+
type: BreakingChangeType.INTERFACE_REMOVED_FROM_OBJECT,
689690
description:
690-
'TypeThatHasBreakingFieldChanges.field2 changed type from String to Boolean.',
691+
'TypeThatLooseInterface1 no longer implements interface Interface1.',
691692
},
692693
{
693694
type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,
694695
description:
695696
'TypeInUnion2 was removed from union type UnionTypeThatLosesAType.',
696697
},
697698
{
698-
type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,
699+
type: BreakingChangeType.TYPE_CHANGED_KIND,
699700
description:
700-
'VALUE0 was removed from enum type EnumTypeThatLosesAValue.',
701+
'TypeThatChangesType changed from an Object type to an Interface type.',
701702
},
702703
{
703-
type: BreakingChangeType.ARG_CHANGED_KIND,
704-
description:
705-
'ArgThatChanges.field1 arg id has changed type from Int to String.',
704+
type: BreakingChangeType.FIELD_REMOVED,
705+
description: 'TypeThatHasBreakingFieldChanges.field1 was removed.',
706706
},
707707
{
708-
type: BreakingChangeType.INTERFACE_REMOVED_FROM_OBJECT,
708+
type: BreakingChangeType.FIELD_CHANGED_KIND,
709709
description:
710-
'TypeThatLooseInterface1 no longer implements interface Interface1.',
710+
'TypeThatHasBreakingFieldChanges.field2 changed type from String to Boolean.',
711711
},
712712
{
713713
type: BreakingChangeType.DIRECTIVE_REMOVED,
@@ -972,11 +972,6 @@ describe('findDangerousChanges', () => {
972972
`);
973973

974974
expect(findDangerousChanges(oldSchema, newSchema)).to.deep.equal([
975-
{
976-
type: DangerousChangeType.TYPE_ADDED_TO_UNION,
977-
description:
978-
'TypeInUnion2 was added to union type UnionTypeThatGainsAType.',
979-
},
980975
{
981976
type: DangerousChangeType.VALUE_ADDED_TO_ENUM,
982977
description: 'VALUE2 was added to enum type EnumType1.',
@@ -991,6 +986,11 @@ describe('findDangerousChanges', () => {
991986
description:
992987
'Interface1 added to interfaces implemented by TypeThatGainsInterface1.',
993988
},
989+
{
990+
type: DangerousChangeType.TYPE_ADDED_TO_UNION,
991+
description:
992+
'TypeInUnion2 was added to union type UnionTypeThatGainsAType.',
993+
},
994994
]);
995995
});
996996

0 commit comments

Comments
 (0)