From 67996cc938eb6b520f9d10f76c999fdd4163804d Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Wed, 23 Feb 2022 02:29:01 +0900 Subject: [PATCH] Add test for Blog::outbox_collection_page() --- plume-models/src/blogs.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index 42cd39ed..90f22ca2 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -1156,4 +1156,25 @@ pub(crate) mod tests { Ok(()) }); } + + #[test] + fn outbox_collection_page() { + let conn = &db(); + conn.test_transaction::<_, Error, _>(|| { + let (_users, blogs) = fill_database(conn); + let blog = &blogs[0]; + let act = blog.outbox_collection_page(conn, (33, 36))?; + + let expected = json!({ + "next": "https://plu.me/~/BlogName/outbox?page=3", + "prev": "https://plu.me/~/BlogName/outbox?page=1", + "items": [], + "type": "OrderedCollectionPage" + }); + + assert_json_eq!(to_value(act)?, expected); + + Ok(()) + }); + } }