Skip to content

Commit 23c29c5

Browse files
committed
added FIELD_REMOVED
1 parent 8ee9b94 commit 23c29c5

File tree

1 file changed

+55
-54
lines changed

1 file changed

+55
-54
lines changed

src/utilities/__tests__/findBreakingChanges-test.js

Lines changed: 55 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -131,60 +131,61 @@ describe('findBreakingChanges', () => {
131131
`);
132132

133133
const changes = findBreakingChanges(oldSchema, newSchema);
134-
expect(changes).to.deep.equal([
135-
{
136-
type: BreakingChangeType.FIELD_REMOVED,
137-
description: 'Type1.field2 was removed.',
138-
},
139-
{
140-
type: BreakingChangeType.FIELD_CHANGED_KIND,
141-
description: 'Type1.field3 changed type from String to Boolean.',
142-
},
143-
{
144-
type: BreakingChangeType.FIELD_CHANGED_KIND,
145-
description: 'Type1.field4 changed type from TypeA to TypeB.',
146-
},
147-
{
148-
type: BreakingChangeType.FIELD_CHANGED_KIND,
149-
description: 'Type1.field6 changed type from String to [String].',
150-
},
151-
{
152-
type: BreakingChangeType.FIELD_CHANGED_KIND,
153-
description: 'Type1.field7 changed type from [String] to String.',
154-
},
155-
{
156-
type: BreakingChangeType.FIELD_CHANGED_KIND,
157-
description: 'Type1.field9 changed type from Int! to Int.',
158-
},
159-
{
160-
type: BreakingChangeType.FIELD_CHANGED_KIND,
161-
description: 'Type1.field10 changed type from [Int]! to [Int].',
162-
},
163-
{
164-
type: BreakingChangeType.FIELD_CHANGED_KIND,
165-
description: 'Type1.field11 changed type from Int to [Int]!.',
166-
},
167-
{
168-
type: BreakingChangeType.FIELD_CHANGED_KIND,
169-
description: 'Type1.field13 changed type from [Int!] to [Int].',
170-
},
171-
{
172-
type: BreakingChangeType.FIELD_CHANGED_KIND,
173-
description: 'Type1.field14 changed type from [Int] to [[Int]].',
174-
},
175-
{
176-
type: BreakingChangeType.FIELD_CHANGED_KIND,
177-
description: 'Type1.field15 changed type from [[Int]] to [Int].',
178-
},
179-
{
180-
type: BreakingChangeType.FIELD_CHANGED_KIND,
181-
description: 'Type1.field16 changed type from Int! to [Int]!.',
182-
},
183-
{
184-
type: BreakingChangeType.FIELD_CHANGED_KIND,
185-
description: 'Type1.field18 changed type from [[Int!]!] to [[Int!]].',
186-
},
187-
]);
134+
expect(changes[0]).to.deep.include({
135+
type: BreakingChangeType.FIELD_REMOVED,
136+
description: 'Type1.field2 was removed.',
137+
});
138+
// $FlowFixMe
139+
expect(changes[0].oldNode.name.value).to.equal('field2');
140+
expect(changes[0]).not.to.have.property('newNode');
141+
expect(changes[1]).to.deep.include({
142+
type: BreakingChangeType.FIELD_CHANGED_KIND,
143+
description: 'Type1.field3 changed type from String to Boolean.',
144+
});
145+
expect(changes[2]).to.deep.include({
146+
type: BreakingChangeType.FIELD_CHANGED_KIND,
147+
description: 'Type1.field4 changed type from TypeA to TypeB.',
148+
});
149+
expect(changes[3]).to.deep.include({
150+
type: BreakingChangeType.FIELD_CHANGED_KIND,
151+
description: 'Type1.field6 changed type from String to [String].',
152+
});
153+
expect(changes[4]).to.deep.include({
154+
type: BreakingChangeType.FIELD_CHANGED_KIND,
155+
description: 'Type1.field7 changed type from [String] to String.',
156+
});
157+
expect(changes[5]).to.deep.include({
158+
type: BreakingChangeType.FIELD_CHANGED_KIND,
159+
description: 'Type1.field9 changed type from Int! to Int.',
160+
});
161+
expect(changes[6]).to.deep.include({
162+
type: BreakingChangeType.FIELD_CHANGED_KIND,
163+
description: 'Type1.field10 changed type from [Int]! to [Int].',
164+
});
165+
expect(changes[7]).to.deep.include({
166+
type: BreakingChangeType.FIELD_CHANGED_KIND,
167+
description: 'Type1.field11 changed type from Int to [Int]!.',
168+
});
169+
expect(changes[8]).to.deep.include({
170+
type: BreakingChangeType.FIELD_CHANGED_KIND,
171+
description: 'Type1.field13 changed type from [Int!] to [Int].',
172+
});
173+
expect(changes[9]).to.deep.include({
174+
type: BreakingChangeType.FIELD_CHANGED_KIND,
175+
description: 'Type1.field14 changed type from [Int] to [[Int]].',
176+
});
177+
expect(changes[10]).to.deep.include({
178+
type: BreakingChangeType.FIELD_CHANGED_KIND,
179+
description: 'Type1.field15 changed type from [[Int]] to [Int].',
180+
});
181+
expect(changes[11]).to.deep.include({
182+
type: BreakingChangeType.FIELD_CHANGED_KIND,
183+
description: 'Type1.field16 changed type from Int! to [Int]!.',
184+
});
185+
expect(changes[12]).to.deep.include({
186+
type: BreakingChangeType.FIELD_CHANGED_KIND,
187+
description: 'Type1.field18 changed type from [[Int!]!] to [[Int!]].',
188+
});
188189
});
189190

190191
it('should detect if fields on input types changed kind or were removed', () => {

0 commit comments

Comments
 (0)