Skip to content

Commit 1bdd6e1

Browse files
committed
fixup! controllers/helpers/pagination: Add seek! helper macro
1 parent 8be70d1 commit 1bdd6e1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/controllers/helpers/pagination.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,25 @@ mod tests {
626626
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
627627
}
628628

629+
#[test]
630+
fn test_seek_macro_conv() {
631+
use chrono::{NaiveDate, NaiveDateTime};
632+
use seek::*;
633+
634+
assert_eq!(Seek::from(SeekPayload::Id(Id(1234))), Seek::Id);
635+
636+
let dt: NaiveDateTime = NaiveDate::from_ymd_opt(2016, 7, 8)
637+
.unwrap()
638+
.and_hms_opt(9, 10, 11)
639+
.unwrap();
640+
assert_eq!(Seek::from(SeekPayload::New(New(dt, 1234))), Seek::New);
641+
642+
assert_eq!(
643+
Seek::from(SeekPayload::RecentDownloads(RecentDownloads(None, 1234))),
644+
Seek::RecentDownloads
645+
);
646+
}
647+
629648
fn mock(query: &str) -> Request<()> {
630649
Request::builder()
631650
.method(Method::GET)

0 commit comments

Comments
 (0)