Skip to content

Commit

Permalink
fixup! controllers/helpers/pagination: Add seek! helper macro
Browse files Browse the repository at this point in the history
  • Loading branch information
eth3lbert committed Jan 23, 2024
1 parent 8be70d1 commit 1bdd6e1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/controllers/helpers/pagination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,25 @@ mod tests {
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
}

#[test]
fn test_seek_macro_conv() {
use chrono::{NaiveDate, NaiveDateTime};
use seek::*;

assert_eq!(Seek::from(SeekPayload::Id(Id(1234))), Seek::Id);

let dt: NaiveDateTime = NaiveDate::from_ymd_opt(2016, 7, 8)
.unwrap()
.and_hms_opt(9, 10, 11)
.unwrap();
assert_eq!(Seek::from(SeekPayload::New(New(dt, 1234))), Seek::New);

assert_eq!(
Seek::from(SeekPayload::RecentDownloads(RecentDownloads(None, 1234))),
Seek::RecentDownloads
);
}

fn mock(query: &str) -> Request<()> {
Request::builder()
.method(Method::GET)
Expand Down

0 comments on commit 1bdd6e1

Please sign in to comment.