diff --git a/src/api/mod.rs b/src/api/mod.rs index ca269e8..3bd553f 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -223,3 +223,28 @@ impl AuthenticatedRequest { self.request.body.as_deref() } } + +#[cfg(test)] +mod tests { + use serde::Serialize; + + use super::UnauthenticatedRequest; + + #[test] + fn extend_query_parameters() { + #[derive(Serialize)] + struct QueryParams { + example: &'static str, + } + + assert_eq!( + UnauthenticatedRequest::<()>::new("https://google.com?test=lol".parse().unwrap()) + .with_query_params(QueryParams { + example: "Some example here", + }) + .unwrap() + .uri, + "https://google.com?test=lol&example=Some+example+here" + ); + } +} diff --git a/src/api/server/models.rs b/src/api/server/models.rs index b71c105..13f880b 100644 --- a/src/api/server/models.rs +++ b/src/api/server/models.rs @@ -203,3 +203,16 @@ pub enum Cancellation { /// Server has not been cancelled. Cancellable(Cancellable), } + +#[cfg(test)] +mod tests { + use crate::api::server::ServerId; + + #[test] + fn server_id_conversion() { + assert_eq!(ServerId(10), ServerId::from(10)); + + assert_eq!(u32::from(ServerId(10)), 10); + assert_eq!(ServerId(10), 10); + } +}