Skip to content

Commit

Permalink
findBreakingChanges: merge funcs and remove duplicated iteration logic (
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed May 26, 2019
1 parent 7e15905 commit 516132a
Show file tree
Hide file tree
Showing 2 changed files with 202 additions and 276 deletions.
36 changes: 18 additions & 18 deletions src/utilities/__tests__/findBreakingChanges-test.js
Expand Up @@ -676,38 +676,38 @@ describe('findBreakingChanges', () => {
description: 'TypeThatGetsRemoved was removed.',
},
{
type: BreakingChangeType.TYPE_CHANGED_KIND,
type: BreakingChangeType.ARG_CHANGED_KIND,
description:
'TypeThatChangesType changed from an Object type to an Interface type.',
'ArgThatChanges.field1 arg id has changed type from Int to String.',
},
{
type: BreakingChangeType.FIELD_REMOVED,
description: 'TypeThatHasBreakingFieldChanges.field1 was removed.',
type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,
description:
'VALUE0 was removed from enum type EnumTypeThatLosesAValue.',
},
{
type: BreakingChangeType.FIELD_CHANGED_KIND,
type: BreakingChangeType.INTERFACE_REMOVED_FROM_OBJECT,
description:
'TypeThatHasBreakingFieldChanges.field2 changed type from String to Boolean.',
'TypeThatLooseInterface1 no longer implements interface Interface1.',
},
{
type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,
description:
'TypeInUnion2 was removed from union type UnionTypeThatLosesAType.',
},
{
type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,
type: BreakingChangeType.TYPE_CHANGED_KIND,
description:
'VALUE0 was removed from enum type EnumTypeThatLosesAValue.',
'TypeThatChangesType changed from an Object type to an Interface type.',
},
{
type: BreakingChangeType.ARG_CHANGED_KIND,
description:
'ArgThatChanges.field1 arg id has changed type from Int to String.',
type: BreakingChangeType.FIELD_REMOVED,
description: 'TypeThatHasBreakingFieldChanges.field1 was removed.',
},
{
type: BreakingChangeType.INTERFACE_REMOVED_FROM_OBJECT,
type: BreakingChangeType.FIELD_CHANGED_KIND,
description:
'TypeThatLooseInterface1 no longer implements interface Interface1.',
'TypeThatHasBreakingFieldChanges.field2 changed type from String to Boolean.',
},
{
type: BreakingChangeType.DIRECTIVE_REMOVED,
Expand Down Expand Up @@ -972,11 +972,6 @@ describe('findDangerousChanges', () => {
`);

expect(findDangerousChanges(oldSchema, newSchema)).to.deep.equal([
{
type: DangerousChangeType.TYPE_ADDED_TO_UNION,
description:
'TypeInUnion2 was added to union type UnionTypeThatGainsAType.',
},
{
type: DangerousChangeType.VALUE_ADDED_TO_ENUM,
description: 'VALUE2 was added to enum type EnumType1.',
Expand All @@ -991,6 +986,11 @@ describe('findDangerousChanges', () => {
description:
'Interface1 added to interfaces implemented by TypeThatGainsInterface1.',
},
{
type: DangerousChangeType.TYPE_ADDED_TO_UNION,
description:
'TypeInUnion2 was added to union type UnionTypeThatGainsAType.',
},
]);
});

Expand Down

0 comments on commit 516132a

Please sign in to comment.