use web_search::providers::{clean_text, decode_html_entities, strip_html};
#[test]
fn decodes_named_entities() {
assert_eq!(
decode_html_entities("a & b <c> "d" 'e'"),
"a & b <c> \"d\" 'e'"
);
assert_eq!(decode_html_entities("x y"), "x y");
assert_eq!(decode_html_entities("a…"), "a…");
assert_eq!(decode_html_entities("a—b–c"), "a—b–c");
}
#[test]
fn decodes_numeric_and_hex_entities() {
assert_eq!(decode_html_entities("©"), "©");
assert_eq!(decode_html_entities("©"), "©");
}
#[test]
fn leaves_unresolvable_references_untouched() {
assert_eq!(decode_html_entities("�"), "�");
assert_eq!(decode_html_entities(""), "");
}
#[test]
fn strips_tags() {
assert_eq!(strip_html("<b>hi</b> <a href=\"x\">there</a>"), "hi there");
assert_eq!(strip_html("plain"), "plain");
}
#[test]
fn clean_text_strips_decodes_and_collapses() {
assert_eq!(clean_text(" <b>A</b> B&C "), "A B&C");
assert_eq!(clean_text("<p>line\n\n two</p>"), "line two");
assert_eq!(clean_text(""), "");
}