diff --git a/Cargo.toml b/Cargo.toml index 3ede801..72276de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,6 +51,7 @@ anyhow = { version = "^1.0.68", optional = true } [features] jpg = ["hmac", "sha2", "base64", "hex"] +test = ["tokio"] exec = ["pretty_env_logger"] search = ["tantivy"] telegram = ["exec", "search", "jpg", "teloxide", "tokio", "md5", "rand"] diff --git a/src/data/corebundle/mod.rs b/src/data/corebundle/mod.rs index 4651a00..86d608d 100644 --- a/src/data/corebundle/mod.rs +++ b/src/data/corebundle/mod.rs @@ -101,7 +101,7 @@ mod tests { #[tokio::test] async fn $id() { let client = reqwest::Client::new(); - let result = CoreBundle::fetch(&client, &format!("https://dd.b.pvp.net/{}", $version), $locale).await; + let result = crate::data::corebundle::CoreBundle::fetch(&client, &format!("https://dd.b.pvp.net/{}", $version), $locale).await; assert!(result.is_ok()); } }; diff --git a/src/data/setbundle/art.rs b/src/data/setbundle/art.rs index 0a329c3..a991916 100644 --- a/src/data/setbundle/art.rs +++ b/src/data/setbundle/art.rs @@ -137,23 +137,4 @@ mod tests { fn deserialize() { assert_eq!(serde_json::de::from_str::<'static, CardArt>(r#"{"gameAbsolutePath": "https://dd.b.pvp.net/latest/set1/en_us/img/cards/01DE001.png", "fullAbsolutePath": "https://dd.b.pvp.net/latest/set1/en_us/img/cards/01DE001-full.png"}"#).unwrap(), CardArt { card_png: String::from("https://dd.b.pvp.net/latest/set1/en_us/img/cards/01DE001.png"), full_png: String::from("https://dd.b.pvp.net/latest/set1/en_us/img/cards/01DE001-full.png") }); } - - #[test] - fn png_to_jpg() { - let art = CardArt { - card_png: String::from("https://dd.b.pvp.net/latest/set1/en_us/img/cards/01DE001.png"), - full_png: String::from( - "https://dd.b.pvp.net/latest/set1/en_us/img/cards/01DE001-full.png", - ), - }; - - assert_eq!( - art.card_jpg(), - "https://objectstorage.eu-milan-1.oraclecloud.com/n/axxdmk4y92aq/b/porobot-storage/o/set1-en_us/en_us/img/cards/01DE001.jpg" - ); - assert_eq!( - art.full_jpg(), - "https://objectstorage.eu-milan-1.oraclecloud.com/n/axxdmk4y92aq/b/porobot-storage/o/set1-en_us/en_us/img/cards/01DE001-full.jpg" - ); - } } diff --git a/src/data/setbundle/mod.rs b/src/data/setbundle/mod.rs index 57e1516..fb6ec39 100644 --- a/src/data/setbundle/mod.rs +++ b/src/data/setbundle/mod.rs @@ -81,7 +81,7 @@ mod tests { #[tokio::test] async fn $id() { let client = reqwest::Client::new(); - let result = SetBundle::fetch(&client, &format!("https://dd.b.pvp.net/{}", $version), $locale, $set).await; + let result = crate::data::setbundle::SetBundle::fetch(&client, &format!("https://dd.b.pvp.net/{}", $version), $locale, $set).await; assert!(result.is_ok()); } };