File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 7676 assert ! ( rule. validate( & message) . is_none( ) ) ;
7777 }
7878
79+ #[ test]
80+ fn test_no_body ( ) {
81+ let rule = BodyMaxLength {
82+ length : usize:: MAX , // Long length for testing
83+ ..Default :: default ( )
84+ } ;
85+ let message = Message {
86+ body : None ,
87+ description : Some ( "broadcast $destroy event on scope destruction" . to_string ( ) ) ,
88+ footers : None ,
89+ r#type : Some ( "feat" . to_string ( ) ) ,
90+ raw : "feat(scope): broadcast $destroy event on scope destruction" . to_string ( ) ,
91+ scope : Some ( "scope" . to_string ( ) ) ,
92+ subject : Some ( "feat(scope): broadcast $destroy event on scope destruction" . to_string ( ) ) ,
93+ } ;
94+
95+ assert ! ( rule. validate( & message) . is_none( ) ) ;
96+ }
97+
7998 #[ test]
8099 fn test_short_body ( ) {
81100 let rule = BodyMaxLength {
Original file line number Diff line number Diff line change @@ -73,6 +73,25 @@ mod tests {
7373 assert ! ( rule. validate( & message) . is_none( ) ) ;
7474 }
7575
76+ #[ test]
77+ fn test_no_scope ( ) {
78+ let rule = ScopeMaxLength {
79+ length : usize:: MAX , // Long length for testing
80+ ..Default :: default ( )
81+ } ;
82+ let message = Message {
83+ body : None ,
84+ description : Some ( "desc" . to_string ( ) ) ,
85+ footers : None ,
86+ r#type : Some ( "feat" . to_string ( ) ) ,
87+ raw : "feat(scope): desc" . to_string ( ) ,
88+ scope : None ,
89+ subject : Some ( "feat(scope): desc" . to_string ( ) ) ,
90+ } ;
91+
92+ assert ! ( rule. validate( & message) . is_none( ) ) ;
93+ }
94+
7695 #[ test]
7796 fn test_short_scope ( ) {
7897 let rule = ScopeMaxLength {
Original file line number Diff line number Diff line change @@ -73,6 +73,25 @@ mod tests {
7373 assert ! ( rule. validate( & message) . is_none( ) ) ;
7474 }
7575
76+ #[ test]
77+ fn test_no_type ( ) {
78+ let rule = TypeMaxLength {
79+ length : usize:: MAX , // Long length for testing
80+ ..Default :: default ( )
81+ } ;
82+ let message = Message {
83+ body : None ,
84+ description : Some ( "broadcast $destroy event on scope destruction" . to_string ( ) ) ,
85+ footers : None ,
86+ r#type : None ,
87+ raw : "feat(scope): broadcast $destroy event on scope destruction" . to_string ( ) ,
88+ scope : Some ( "scope" . to_string ( ) ) ,
89+ subject : Some ( "feat(scope): broadcast $destroy event on scope destruction" . to_string ( ) ) ,
90+ } ;
91+
92+ assert ! ( rule. validate( & message) . is_none( ) ) ;
93+ }
94+
7695 #[ test]
7796 fn test_short_type ( ) {
7897 let rule = TypeMaxLength {
You can’t perform that action at this time.
0 commit comments