feat: Add comprehensive unit tests for CLI and CertificateService, covering command parsing and certificate generation

This commit is contained in:
GW_MC
2026-03-21 03:42:47 +00:00
parent eba30f557e
commit 109d693d59
4 changed files with 707 additions and 0 deletions

View File

@@ -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"));
}
}