use super::*;
#[test]
fn credentialed_wildcard_rejected_in_debug() {
let result = CorsConfigBuilder::default()
.allow_origin("*")
.allow_credentials(true)
.build();
assert_eq!(result, Err(CorsConfigError::CredentialedWildcard));
}
#[test]
fn credentialed_wildcard_rejected_in_release() {
let result = CorsConfigBuilder::default()
.allow_origin("*")
.allow_credentials(true)
.build();
assert_eq!(result, Err(CorsConfigError::CredentialedWildcard));
}
#[test]
fn explicit_origin_with_credentials_allowed() {
let config = CorsConfigBuilder::default()
.allow_origin("https://example.com")
.allow_credentials(true)
.build();
assert!(config.is_ok());
let cfg = config.unwrap();
assert!(!cfg.allow_all_origins);
assert!(cfg.credentials);
}
#[test]
fn wildcard_without_credentials_allowed() {
let config = CorsConfigBuilder::default()
.allow_origin("*")
.allow_credentials(false)
.build();
assert!(config.is_ok());
let cfg = config.unwrap();
assert!(cfg.allow_all_origins);
assert!(!cfg.credentials);
}