@@ -152,3 +152,46 @@ fn format_dependency_list(dependencies: &[Dependency]) -> String {
152152 . collect :: < Vec < _ > > ( )
153153 . join ( ", " )
154154}
155+
156+ #[ cfg( test) ]
157+ mod tests {
158+ use super :: * ;
159+
160+ #[ test]
161+ fn test_verify_dependencies_with_installed_dependency ( ) {
162+ // Test with Ansible which should be installed
163+ let deps = & [ Dependency :: Ansible ] ;
164+ let result = verify_dependencies ( deps) ;
165+
166+ // This should succeed since Ansible is installed
167+ assert ! ( result. is_ok( ) , "Ansible dependency check should pass" ) ;
168+ }
169+
170+ #[ test]
171+ fn test_dependency_verification_error_actionable_message ( ) {
172+ let error = DependencyVerificationError :: MissingDependencies {
173+ dependencies : vec ! [ Dependency :: OpenTofu , Dependency :: Lxd ] ,
174+ } ;
175+
176+ let message = error. actionable_message ( ) ;
177+
178+ // Verify the message contains key information
179+ assert ! ( message. contains( "opentofu" ) ) ;
180+ assert ! ( message. contains( "lxd" ) ) ;
181+ assert ! ( message. contains( "cargo run --bin dependency-installer install" ) ) ;
182+ assert ! ( message. contains( "README.md" ) ) ;
183+ }
184+
185+ #[ test]
186+ fn test_dependency_verification_error_display ( ) {
187+ let error = DependencyVerificationError :: MissingDependencies {
188+ dependencies : vec ! [ Dependency :: Ansible ] ,
189+ } ;
190+
191+ let error_string = error. to_string ( ) ;
192+
193+ // Verify the error display format
194+ assert ! ( error_string. contains( "Missing required dependencies" ) ) ;
195+ assert ! ( error_string. contains( "ansible" ) ) ;
196+ }
197+ }
0 commit comments