@@ -93,4 +93,46 @@ mod tests {
9393 }
9494 . to_config ( ) ;
9595 }
96+
97+ fn write_temp_yaml ( name : & str , content : & str ) -> String {
98+ let path = std:: env:: temp_dir ( ) . join ( name) ;
99+ std:: fs:: write ( & path, content) . unwrap ( ) ;
100+ path. to_string_lossy ( ) . into_owned ( )
101+ }
102+
103+ #[ test]
104+ fn validate_returns_false_when_no_client_section ( ) {
105+ let path = write_temp_yaml ( "kickable_test_client_none.yaml" , "items:\n - it\n " ) ;
106+ assert ! ( !validate( & ClientArgs {
107+ item: "it" . to_string( ) ,
108+ config: path,
109+ } ) ) ;
110+ }
111+
112+ #[ test]
113+ fn validate_returns_false_for_empty_item ( ) {
114+ assert ! ( !validate( & ClientArgs {
115+ item: " " . to_string( ) ,
116+ config: "kickable.yaml" . to_string( ) ,
117+ } ) ) ;
118+ }
119+
120+ #[ test]
121+ fn display_returns_empty_when_no_client_section ( ) {
122+ let path = write_temp_yaml ( "kickable_test_client_display_none.yaml" , "items:\n - it\n " ) ;
123+ let args = ClientArgs {
124+ item : "it" . to_string ( ) ,
125+ config : path,
126+ } ;
127+ assert_eq ! ( format!( "{args}" ) , "" ) ;
128+ }
129+
130+ #[ test]
131+ fn display_returns_addr_port ( ) {
132+ let args = ClientArgs {
133+ item : "it" . to_string ( ) ,
134+ config : "kickable.yaml" . to_string ( ) ,
135+ } ;
136+ assert_eq ! ( format!( "{args}" ) , "0.0.0.0:8080" ) ;
137+ }
96138}
0 commit comments