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
This commit is contained in:
30
crates/adapters/rss/tests/parser_tests.rs
Normal file
30
crates/adapters/rss/tests/parser_tests.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
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())));
|
||||
}
|
||||
Reference in New Issue
Block a user