@@ -37,6 +37,32 @@ describe('findBreakingChanges', () => {
37
37
expect ( findBreakingChanges ( oldSchema , oldSchema ) ) . to . deep . equal ( [ ] ) ;
38
38
} ) ;
39
39
40
+ it ( 'should detect if a standard scalar was removed' , ( ) => {
41
+ const oldSchema = buildSchema ( `
42
+ type Query {
43
+ foo: Float
44
+ }
45
+ ` ) ;
46
+
47
+ const newSchema = buildSchema ( `
48
+ type Query {
49
+ foo: String
50
+ }
51
+ ` ) ;
52
+ expect ( findBreakingChanges ( oldSchema , newSchema ) ) . to . deep . equal ( [
53
+ {
54
+ type : BreakingChangeType . TYPE_REMOVED ,
55
+ description :
56
+ 'Standard scalar Float was removed because it is not referenced anymore.' ,
57
+ } ,
58
+ {
59
+ type : BreakingChangeType . FIELD_CHANGED_KIND ,
60
+ description : 'Query.foo changed type from Float to String.' ,
61
+ } ,
62
+ ] ) ;
63
+ expect ( findBreakingChanges ( oldSchema , oldSchema ) ) . to . deep . equal ( [ ] ) ;
64
+ } ) ;
65
+
40
66
it ( 'should detect if a type changed its type' , ( ) => {
41
67
const oldSchema = buildSchema ( `
42
68
scalar TypeWasScalarBecomesEnum
@@ -601,7 +627,7 @@ describe('findBreakingChanges', () => {
601
627
directive @DirectiveName on FIELD_DEFINITION | QUERY
602
628
603
629
type ArgThatChanges {
604
- field1(id: Int ): String
630
+ field1(id: Float ): String
605
631
}
606
632
607
633
enum EnumTypeThatLosesAValue {
@@ -660,7 +686,8 @@ describe('findBreakingChanges', () => {
660
686
expect ( findBreakingChanges ( oldSchema , newSchema ) ) . to . deep . equal ( [
661
687
{
662
688
type : BreakingChangeType . TYPE_REMOVED ,
663
- description : 'Int was removed.' ,
689
+ description :
690
+ 'Standard scalar Float was removed because it is not referenced anymore.' ,
664
691
} ,
665
692
{
666
693
type : BreakingChangeType . TYPE_REMOVED ,
@@ -669,7 +696,7 @@ describe('findBreakingChanges', () => {
669
696
{
670
697
type : BreakingChangeType . ARG_CHANGED_KIND ,
671
698
description :
672
- 'ArgThatChanges.field1 arg id has changed type from Int to String.' ,
699
+ 'ArgThatChanges.field1 arg id has changed type from Float to String.' ,
673
700
} ,
674
701
{
675
702
type : BreakingChangeType . VALUE_REMOVED_FROM_ENUM ,
0 commit comments