BREAKING CHANGE: the configuration for Bitmagnet and Ntfy has changed. Instead of `host`, they now use `url`.
38 lines
833 B
Rust
38 lines
833 B
Rust
use crate::actions::bitmagnet::BitmagnetConfig;
|
|
use crate::config::Validate;
|
|
use color_eyre::eyre::Result;
|
|
|
|
impl Validate for BitmagnetConfig {
|
|
fn validate(&self) -> Result<()> {
|
|
Ok(())
|
|
}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
use url::Url;
|
|
|
|
fn create_valid_config() -> Result<BitmagnetConfig> {
|
|
Ok(BitmagnetConfig {
|
|
enable: true,
|
|
url: Url::parse("http://localhost:8080")?,
|
|
})
|
|
}
|
|
|
|
#[test]
|
|
fn test_valid_config() -> Result<()> {
|
|
let config = create_valid_config()?;
|
|
|
|
assert!(config.validate().is_ok());
|
|
|
|
Ok(())
|
|
}
|
|
|
|
#[test]
|
|
fn test_invalid_url() -> Result<()> {
|
|
// This test is no longer needed as the Url type handles validation
|
|
// and will not allow invalid URLs to be created
|
|
Ok(())
|
|
}
|
|
}
|