fix(content): complete provider hardening
This commit is contained in:
1 parent
695ba5a758
commit
062a9234ee
7 files changed
+65
-36
No files matched your search
+26
-1
@@ -154,7 +154,10 @@ async fn modrinth_discovery_returns_unique_compatible_mods() {
|
||||
.iter()
|
||||
.find_map(|project| project.icon_url.as_deref())
|
||||
.expect("expected at least one project icon");
|
||||
let icon = client.get_bytes(icon_url).await.unwrap();
|
||||
let icon = client
|
||||
.get_bytes_limited(icon_url, net::MAX_PROVIDER_ASSET_BYTES)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(image::load_from_memory(&icon).is_ok());
|
||||
|
||||
let mut seen = result
|
||||
@@ -183,3 +186,25 @@ async fn modrinth_discovery_returns_unique_compatible_mods() {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[ignore = "hits live CurseForge API"]
|
||||
async fn curseforge_discovery_returns_compatible_mods() {
|
||||
let api_key = net::curseforge::api_key().expect("build has no CurseForge API key");
|
||||
let result = net::curseforge::search_discovery(
|
||||
&HttpClient::new(),
|
||||
api_key,
|
||||
ContentKind::Mod,
|
||||
"sodium",
|
||||
"1.21.1",
|
||||
ModLoader::Fabric,
|
||||
0,
|
||||
20,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(!result.projects.is_empty());
|
||||
assert!(result.total_hits >= result.projects.len());
|
||||
assert!(result.projects.iter().all(|project| !project.id.is_empty()));
|
||||
}
|
||||
Reference in new issue
Block a user