use nstreams_rabbit::RabbitConfig;
#[test]
fn parses_standard_amqp_url() {
let config = RabbitConfig::from_amqp_url("amqp://guest:secret@rabbit.example:5672/myvhost").unwrap();
assert_eq!(config.host, "rabbit.example");
assert_eq!(config.amqp_port, 5672);
assert_eq!(config.stream_port, 5552);
assert_eq!(config.user, "guest");
assert_eq!(config.password, "secret");
assert_eq!(config.vhost, "myvhost");
}
#[test]
fn defaults_vhost_and_port() {
let config = RabbitConfig::from_amqp_url("amqp://user:pass@localhost").unwrap();
assert_eq!(config.amqp_port, 5672);
assert_eq!(config.vhost, "/");
}
#[test]
fn rejects_invalid_scheme() {
assert!(RabbitConfig::from_amqp_url("http://localhost").is_err());
}