diff options
Diffstat (limited to 'kittybox-rs/src/database/mod.rs')
-rw-r--r-- | kittybox-rs/src/database/mod.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/kittybox-rs/src/database/mod.rs b/kittybox-rs/src/database/mod.rs index 4f1c4de..b4b70b2 100644 --- a/kittybox-rs/src/database/mod.rs +++ b/kittybox-rs/src/database/mod.rs @@ -717,6 +717,25 @@ mod tests { assert_eq!(read_post["properties"]["comment"][0], reply); } + async fn test_pretty_permalinks<Backend: Storage>(db: Backend) { + const PERMALINK: &str = "https://fireburn.ru/posts/pretty-permalink"; + + let post = { + let mut post = gen_random_post("fireburn.ru"); + let urls = post["properties"]["url"].as_array_mut().unwrap(); + urls.push(serde_json::Value::String( + PERMALINK.to_owned() + )); + + post + }; + db.put_post(&post, "fireburn.ru").await.unwrap(); + + for i in post["properties"]["url"].as_array().unwrap() { + let (read_post, _) = db.read_feed_with_cursor(i.as_str().unwrap(), None, 20, None).await.unwrap().unwrap(); + assert_eq!(read_post, post); + } + } /// Automatically generates a test suite for macro_rules! test_all { ($func_name:ident, $mod_name:ident) => { @@ -727,6 +746,7 @@ mod tests { $func_name!(test_update); $func_name!(test_feed_pagination); $func_name!(test_webmention_addition); + $func_name!(test_pretty_permalinks); } }; } |