Wrapped test

This commit is contained in:
Lukas Wölfer
2025-08-12 21:43:06 +02:00
parent 2faf8038fe
commit 22fa677d8a

View File

@@ -32,21 +32,28 @@ pub async fn fetch_wsdc_info(id: u32) -> Result<DanceInfo, DanceInfoError> {
Ok(x.into()) Ok(x.into())
} }
#[test] #[cfg(test)]
#[ignore = "Only run when the mock api is setup"] mod tests {
fn test_fetch_wsdc() { #![allow(clippy::unwrap_used, reason="Allow unwrap in tests")]
let rt = match tokio::runtime::Builder::new_current_thread() use crate::worldsdc::fetch_wsdc_info;
.enable_all()
.build() #[test]
{ #[ignore = "Only run when the mock api is setup"]
Ok(o) => o, fn test_fetch_wsdc() {
Err(e) => { let rt = match tokio::runtime::Builder::new_current_thread()
tracing::error!("Could not start runtime: {e}"); .enable_all()
return; .build()
} {
}; Ok(o) => o,
let x = rt.block_on(fetch_wsdc_info(7)); Err(e) => {
dbg!(x); 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)] #[derive(thiserror::Error, Debug)]