about summary refs log tree commit diff
path: root/kittybox-rs
diff options
context:
space:
mode:
Diffstat (limited to 'kittybox-rs')
-rw-r--r--kittybox-rs/src/database/mod.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/kittybox-rs/src/database/mod.rs b/kittybox-rs/src/database/mod.rs
index cb4c0b9..94a93ca 100644
--- a/kittybox-rs/src/database/mod.rs
+++ b/kittybox-rs/src/database/mod.rs
@@ -543,12 +543,14 @@ mod tests {
             rand::random::<Word>()
         );
 
+        let time = chrono::Local::now().to_rfc3339();
         let post = json!({
             "type": ["h-entry"],
             "properties": {
                 "content": [rand::random::<Paragraphs>().to_string()],
                 "uid": [&uid],
-                "url": [&uid]
+                "url": [&uid],
+                "published": [&time]
             }
         });
 
@@ -558,6 +560,9 @@ mod tests {
     async fn test_feed_pagination<Backend: Storage>(backend: Backend) {
         let posts = std::iter::from_fn(|| Some(gen_random_post("fireburn.ru")))
             .take(20)
+            .collect::<Vec<serde_json::Value>>()
+            .into_iter()
+            .rev()
             .collect::<Vec<serde_json::Value>>();
 
         let feed = json!({
@@ -596,6 +601,7 @@ mod tests {
             println!("feed[0][{}] = {}", i, post["properties"]["uid"][0]);
         }
         println!("---");
+        assert!(result["children"].as_array().unwrap().len() <= limit);
         assert_eq!(result["children"].as_array().unwrap()[0..10], posts[0..10]);
 
         let result2 = backend