Files
k-frame/crates/adapters/rss/tests/parser_tests.rs
Gabriel Kaszewski 6e77236936 refactor adapters into modular file structure
config-sqlite: split into repository/ (per entity) + serialization/ (per type) + error.rs
http-api: split into dto/ (per resource) + routes/ (per resource)
tcp-server: split into broadcaster, event_bus, server, error
rss: split parser from adapter, external tests
media: split error, external tests
2026-06-18 22:57:58 +02:00

31 lines
1.2 KiB
Rust

use domain::Value;
use rss_adapter::{parse_rss, RssError};
const SAMPLE_RSS: &str = r#"<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Test Feed</title>
<link>https://example.com</link>
<item>
<title>First Article</title>
<description>Description of first article</description>
<link>https://example.com/1</link>
</item>
<item>
<title>Second Article</title>
<description>Description of second</description>
<link>https://example.com/2</link>
</item>
</channel>
</rss>"#;
#[test]
fn parses_rss_into_value() {
let result = parse_rss(SAMPLE_RSS).unwrap();
assert_eq!(result.get_path("$.title"), Some(&Value::String("Test Feed".into())));
assert_eq!(result.get_path("$.items[0].title"), Some(&Value::String("First Article".into())));
assert_eq!(result.get_path("$.items[1].title"), Some(&Value::String("Second Article".into())));
assert_eq!(result.get_path("$.items[0].description"), Some(&Value::String("Description of first article".into())));
}