From 22fa677d8a523f15fe0fce9a4cd6f42170ac295b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20W=C3=B6lfer?= Date: Tue, 12 Aug 2025 21:43:06 +0200 Subject: [PATCH] Wrapped test --- src/worldsdc/mod.rs | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/worldsdc/mod.rs b/src/worldsdc/mod.rs index cd62146..cf90db8 100644 --- a/src/worldsdc/mod.rs +++ b/src/worldsdc/mod.rs @@ -32,21 +32,28 @@ pub async fn fetch_wsdc_info(id: u32) -> Result { Ok(x.into()) } -#[test] -#[ignore = "Only run when the mock api is setup"] -fn test_fetch_wsdc() { - let rt = match tokio::runtime::Builder::new_current_thread() - .enable_all() - .build() - { - Ok(o) => o, - Err(e) => { - tracing::error!("Could not start runtime: {e}"); - return; - } - }; - let x = rt.block_on(fetch_wsdc_info(7)); - dbg!(x); +#[cfg(test)] +mod tests { + #![allow(clippy::unwrap_used, reason="Allow unwrap in tests")] + use crate::worldsdc::fetch_wsdc_info; + + #[test] + #[ignore = "Only run when the mock api is setup"] + fn test_fetch_wsdc() { + let rt = match tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + { + Ok(o) => o, + Err(e) => { + tracing::error!("Could not start runtime: {e}"); + return; + } + }; + let x = rt.block_on(fetch_wsdc_info(7)); + dbg!(&x); + x.unwrap(); + } } #[derive(thiserror::Error, Debug)]