Skip to content

Commit 04b36f4

Browse files
committed
went to returning the full ASTNode and adapted the tests
1 parent 6d86136 commit 04b36f4

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

src/utilities/__tests__/findBreakingChanges-test.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,14 @@ describe('findBreakingChanges', () => {
3737
const newSchema = buildSchema(`
3838
type Type2
3939
`);
40-
expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([
41-
{
42-
type: BreakingChangeType.TYPE_REMOVED,
43-
description: 'Type1 was removed.',
44-
oldLoc: {
45-
startLine: 2,
46-
startColumn: 7,
47-
endLine: 4,
48-
endColumn: 8,
49-
},
50-
},
51-
]);
40+
expect(findBreakingChanges(oldSchema, newSchema)[0]).to.deep.include({
41+
type: BreakingChangeType.TYPE_REMOVED,
42+
description: 'Type1 was removed.',
43+
});
44+
// flow ensures that oldNode is of type ASTNode, checking its presence should be enough
45+
expect(findBreakingChanges(oldSchema, newSchema)[0]).to.have.property(
46+
'oldNode',
47+
);
5248
expect(findBreakingChanges(oldSchema, oldSchema)).to.deep.equal([]);
5349
});
5450

src/utilities/findBreakingChanges.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ export const DangerousChangeType = Object.freeze({
6767
export type BreakingChange = {
6868
type: $Keys<typeof BreakingChangeType>,
6969
description: string,
70-
oldLoc?: ASTNode,
71-
newLoc?: ASTNode,
70+
oldNode?: ASTNode,
71+
newNode?: ASTNode,
7272
};
7373

7474
export type DangerousChange = {

0 commit comments

Comments
 (0)