- React SPA: dashboard, data sources CRUD, widgets CRUD, layout builder, presets. TanStack Router + Query, shadcn/ui, Vite proxy to :3000 - wire media + rss adapters into polling loop, remove xtb source type - media adapter: read username/password from headers, proper subsonic auth - event handler: subscribe to LayoutChanged, push screen update to clients - fix clippy warnings across workspace (Default impls, collapsible ifs, redundant closures, is_none_or, unused imports)
43 lines
1.2 KiB
Rust
43 lines
1.2 KiB
Rust
use domain::Value;
|
|
use rss_adapter::{RssError, parse_rss};
|
|
|
|
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()))
|
|
);
|
|
}
|