@@ -3,7 +3,6 @@ package sizing
33import  (
44	"github.com/bivas/rivi/bot/mock" 
55	"github.com/stretchr/testify/assert" 
6- 	"sort" 
76	"testing" 
87)
98
@@ -15,6 +14,7 @@ func buildRule(name, label string, changedFiles int) *sizingRule {
1514
1615func  buildRules (withDefault  bool ) * action  {
1716	result  :=  & action {items : rules {
17+ 		* buildRule ("l" , "size/l" , 150 ),
1818		* buildRule ("xs" , "size/xs" , 5 ),
1919		* buildRule ("s" , "size/s" , 15 ),
2020		* buildRule ("m" , "size/m" , 75 ),
@@ -27,10 +27,18 @@ func buildRules(withDefault bool) *action {
2727		result .possibleLabels  =  append (result .possibleLabels , "default-label" )
2828		result .items  =  append (result .items , sizingRule {Name : "default" , Label : "default-label" })
2929	}
30- 	sort .Sort (sort .Reverse (result .items ))
3130	return  result 
3231}
3332
33+ func  TestSizingXS (t  * testing.T ) {
34+ 	action  :=  buildRules (false )
35+ 	config  :=  & mock.MockConfiguration {}
36+ 	meta  :=  & mock.MockEventData {Labels : []string {}, ChangedFiles : 1 , ChangesAdd : 24 , ChangesRemove : 31 }
37+ 	action .Apply (config , meta )
38+ 	assert .Len (t , meta .AddedLabels , 1 , "labels" )
39+ 	assert .Equal (t , "size/xs" , meta .AddedLabels [0 ], "size label" )
40+ }
41+ 
3442func  TestSizing (t  * testing.T ) {
3543	action  :=  buildRules (false )
3644	config  :=  & mock.MockConfiguration {}
0 commit comments