use craft_anything_js::html::scan_html; /// Legacy language values that do not select a JavaScript MIME type add no script evidence. #[test] fn omits_unsupported_legacy_languages() { let html = r#" "#; assert!(scan_html(html).scripts.is_empty()); } /// Standard classic legacy names and the default still work. #[test] fn keeps_classic_legacy_languages_and_empty_language() { let html = r#" "#; let facts = scan_html(html); let scripts: Vec<_> = facts.scripts.iter().map(|s| (s.src.as_deref().unwrap(), s.module)).collect(); assert_eq!(scripts, [("/legacy.js", false), ("/version.js", false), ("/jscript.js", false), ("/default.js", false)]); } /// An explicit type overrides all legacy language values, even when the type is empty. #[test] fn honors_explicit_type_over_legacy_language() { let html = r#" "#; let facts = scan_html(html); let scripts: Vec<_> = facts.scripts.iter().map(|s| (s.src.as_deref().unwrap(), s.module)).collect(); assert_eq!(scripts, [("/module.js", true), ("/classic.js", false), ("/explicit.jsx", false)]); }