pub mod platform;
pub use drasi_lib::bootstrap::PlatformBootstrapConfig;
pub use platform::{PlatformBootstrapProvider, PlatformBootstrapProviderBuilder};
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_platform_bootstrap_builder_requires_url() {
let result = PlatformBootstrapProviderBuilder::new().build();
assert!(result.is_err());
}
#[test]
fn test_platform_bootstrap_builder_with_valid_url() {
let result = PlatformBootstrapProviderBuilder::new()
.with_query_api_url("http://remote-drasi:8080") .with_timeout_seconds(600)
.build();
assert!(result.is_ok());
}
#[test]
fn test_platform_bootstrap_builder_invalid_url() {
let result = PlatformBootstrapProviderBuilder::new()
.with_query_api_url("not-a-valid-url")
.build();
assert!(result.is_err());
}
#[test]
fn test_platform_bootstrap_builder_default() {
let builder = PlatformBootstrapProviderBuilder::default();
let result = builder.build();
assert!(result.is_err());
}
#[test]
fn test_platform_bootstrap_from_provider_method() {
let result = PlatformBootstrapProvider::builder()
.with_query_api_url("http://source-api:9000") .with_timeout_seconds(900)
.build();
assert!(result.is_ok());
}
#[test]
fn test_platform_bootstrap_new_with_config() {
let config = PlatformBootstrapConfig {
query_api_url: Some("http://localhost:8080".to_string()), timeout_seconds: 300,
};
let result = PlatformBootstrapProvider::new(config);
assert!(result.is_ok());
}
#[test]
fn test_platform_bootstrap_new_without_url() {
let config = PlatformBootstrapConfig {
query_api_url: None,
timeout_seconds: 300,
};
let result = PlatformBootstrapProvider::new(config);
assert!(result.is_err());
}
#[test]
fn test_platform_bootstrap_with_url() {
let result = PlatformBootstrapProvider::with_url("http://example.com:8080", 600); assert!(result.is_ok());
}
}