feat: Add comprehensive unit tests for CLI and CertificateService, covering command parsing and certificate generation
This commit is contained in:
@@ -9,3 +9,16 @@ pub(crate) async fn establish_connection(
|
||||
.await
|
||||
.map_err(|e| format!("Failed to connect to database: {}", e).into())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::establish_connection;
|
||||
|
||||
#[tokio::test]
|
||||
async fn establish_connection_fails_for_invalid_url_scheme() {
|
||||
let result = establish_connection("invalid://not-a-db").await;
|
||||
assert!(result.is_err());
|
||||
let msg = result.err().map(|e| e.to_string()).unwrap_or_default();
|
||||
assert!(msg.contains("Failed to connect to database"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user