use super::*;
#[test]
fn test_har_replay_options_builder() {
let options = HarReplayOptions::new()
.url("**/api/**")
.strict(true)
.update(false)
.use_original_timing(true);
assert!(options.url_filter.is_some());
assert!(options.strict);
assert!(!options.update);
assert!(options.use_original_timing);
}
#[test]
fn test_url_matching() {
let handler = HarReplayHandler::from_har(Har::new("test", "1.0"));
assert!(handler.url_matches(
"https://example.com/api/users",
"https://example.com/api/users"
));
assert!(!handler.url_matches(
"https://example.com/api/users",
"https://example.com/api/posts"
));
assert!(handler.url_matches(
"https://example.com/api?a=1",
"https://example.com/api?a=1&b=2"
));
assert!(!handler.url_matches("https://example.com/api?a=1", "https://example.com/api?b=2"));
}
#[test]
fn test_post_data_matching() {
let handler = HarReplayHandler::from_har(Har::new("test", "1.0"));
assert!(handler.post_data_matches("hello", "hello"));
assert!(handler.post_data_matches(r#"{"a":1,"b":2}"#, r#"{"b":2,"a":1}"#));
assert!(!handler.post_data_matches(r#"{"a":1}"#, r#"{"a":2}"#));
}