@@ -9,11 +9,11 @@ import (
99)
1010
1111func TestBreaking_Same (t * testing.T ) {
12- require .False (t , d (t , diff .NewConfig () , 1 , 1 ).Breaking ())
12+ require .True (t , d (t , & diff.Config { BreakingOnly : true } , 1 , 1 ).Empty ())
1313}
1414
1515func TestBreaking_DeletedPaths (t * testing.T ) {
16- require .True (t , d (t , diff .NewConfig () , 1 , 2 ).Breaking ())
16+ require .False (t , d (t , & diff.Config { BreakingOnly : true } , 1 , 2 ).Empty ())
1717}
1818
1919func TestBreaking_DeletedTagAllChanges (t * testing.T ) {
@@ -36,24 +36,35 @@ func TestBreaking_DeletedEnum(t *testing.T) {
3636}
3737
3838func TestBreaking_AddedEnum (t * testing.T ) {
39- require .False (t ,
39+ require .Nil (t ,
4040 d (t , & diff.Config {
4141 BreakingOnly : true ,
42- }, 1 , 3 ).PathsDiff .Modified [installCommandPath ].OperationsDiff .Modified ["GET" ].ParametersDiff .Modified [openapi3 .ParameterInPath ]. Breaking () )
42+ }, 1 , 3 ).PathsDiff .Modified [installCommandPath ].OperationsDiff .Modified ["GET" ].ParametersDiff .Modified [openapi3 .ParameterInPath ])
4343}
4444
4545func TestBreaking_ModifiedExtension (t * testing.T ) {
4646 config := diff.Config {
47+ BreakingOnly : true ,
4748 IncludeExtensions : diff.StringSet {"x-extension-test2" : struct {}{}},
4849 }
4950
50- require .False (t , d (t , & config , 1 , 3 ).ExtensionsDiff .Breaking ())
51+ require .True (t , d (t , & config , 1 , 3 ).ExtensionsDiff .Empty ())
5152}
5253
53- func TestBreaking_Ref (t * testing.T ) {
54- require .True (t ,
55- d (t , diff .NewConfig (), 1 , 3 ).RequestBodiesDiff .Modified ["reuven" ].ContentDiff .MediaTypeModified ["application/json" ].SchemaDiff .PropertiesDiff .Modified ["meter_value" ].TypeDiff .Breaking (),
56- )
54+ func TestBreaking_Components (t * testing.T ) {
55+
56+ dd := d (t , & diff.Config {BreakingOnly : true },
57+ 1 , 3 )
58+
59+ require .Empty (t , dd .SchemasDiff )
60+ require .Empty (t , dd .ParametersDiff )
61+ require .Empty (t , dd .HeadersDiff )
62+ require .Empty (t , dd .RequestBodiesDiff )
63+ require .Empty (t , dd .ResponsesDiff )
64+ require .Empty (t , dd .SecuritySchemesDiff )
65+ require .Empty (t , dd .ExamplesDiff )
66+ require .Empty (t , dd .LinksDiff )
67+ require .Empty (t , dd .CallbacksDiff )
5768}
5869
5970func TestCompareWithDefault (t * testing.T ) {
@@ -82,7 +93,7 @@ func TestBreaking_MaxLengthSmaller(t *testing.T) {
8293 BreakingOnly : true ,
8394 }, s1 , s2 )
8495 require .NoError (t , err )
85- require .True (t , d .Breaking ())
96+ require .False (t , d .Empty ())
8697}
8798
8899func TestBreaking_MaxLengthGreater (t * testing.T ) {
@@ -99,7 +110,7 @@ func TestBreaking_MaxLengthGreater(t *testing.T) {
99110 BreakingOnly : true ,
100111 }, s1 , s2 )
101112 require .NoError (t , err )
102- require .False (t , d .Breaking ())
113+ require .True (t , d .Empty ())
103114}
104115
105116func TestBreaking_MaxLengthFromNil (t * testing.T ) {
@@ -115,7 +126,7 @@ func TestBreaking_MaxLengthFromNil(t *testing.T) {
115126 BreakingOnly : true ,
116127 }, s1 , s2 )
117128 require .NoError (t , err )
118- require .True (t , d .Breaking ())
129+ require .False (t , d .Empty ())
119130}
120131
121132func TestBreaking_MaxLengthToNil (t * testing.T ) {
@@ -131,7 +142,7 @@ func TestBreaking_MaxLengthToNil(t *testing.T) {
131142 BreakingOnly : true ,
132143 }, s1 , s2 )
133144 require .NoError (t , err )
134- require .False (t , d .Breaking ())
145+ require .True (t , d .Empty ())
135146}
136147
137148func TestBreaking_MaxLengthBothNil (t * testing.T ) {
@@ -145,7 +156,7 @@ func TestBreaking_MaxLengthBothNil(t *testing.T) {
145156 BreakingOnly : true ,
146157 }, s1 , s2 )
147158 require .NoError (t , err )
148- require .False (t , d .Breaking ())
159+ require .True (t , d .Empty ())
149160}
150161
151162func TestBreaking_MinItemsSmaller (t * testing.T ) {
@@ -159,7 +170,7 @@ func TestBreaking_MinItemsSmaller(t *testing.T) {
159170 BreakingOnly : true ,
160171 }, s1 , s2 )
161172 require .NoError (t , err )
162- require .False (t , d .Breaking ())
173+ require .True (t , d .Empty ())
163174}
164175
165176func TestBreaking_MinItemsGreater (t * testing.T ) {
@@ -173,5 +184,5 @@ func TestBreaking_MinItemsGreater(t *testing.T) {
173184 BreakingOnly : true ,
174185 }, s1 , s2 )
175186 require .NoError (t , err )
176- require .True (t , d .Breaking ())
187+ require .False (t , d .Empty ())
177188}
0 commit comments