test: remove redundant coverage
This commit is contained in:
1 parent
6138e248cb
commit
6f0825c321
7 files changed
+7
-116
No files matched your search
+3
-14
@@ -196,7 +196,7 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn offline_uuid_is_valid_format() {
|
||||
fn offline_uuid_has_valid_v3_shape() {
|
||||
let uuid = offline_uuid("Steve");
|
||||
let parts: Vec<&str> = uuid.split('-').collect();
|
||||
assert_eq!(parts.len(), 5, "UUID must have 5 dash-separated parts");
|
||||
@@ -205,19 +205,8 @@ mod tests {
|
||||
assert_eq!(parts[2].len(), 4);
|
||||
assert_eq!(parts[3].len(), 4);
|
||||
assert_eq!(parts[4].len(), 12);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn offline_uuid_version_3_marker() {
|
||||
let uuid = offline_uuid("Steve");
|
||||
assert!(uuid.split('-').nth(2).unwrap().starts_with('3'));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn offline_uuid_variant_bit_set() {
|
||||
let uuid = offline_uuid("Steve");
|
||||
let part3 = uuid.split('-').nth(3).unwrap();
|
||||
let first_nibble = u8::from_str_radix(&part3[..1], 16).unwrap();
|
||||
assert!(parts[2].starts_with('3'));
|
||||
let first_nibble = u8::from_str_radix(&parts[3][..1], 16).unwrap();
|
||||
assert!((0x8..=0xb).contains(&first_nibble));
|
||||
}
|
||||
|
||||
|
||||
@@ -672,16 +672,6 @@ mod tests {
|
||||
assert!(mods.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scan_mods_finds_jar_files() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let dir = setup_mods_dir(tmp.path(), "inst");
|
||||
std::fs::write(dir.join("cool-mod.jar"), b"PK\x03\x04").unwrap();
|
||||
std::fs::write(dir.join("other-mod.jar.disabled"), b"PK\x03\x04").unwrap();
|
||||
let mods = scan_mods(tmp.path(), "inst");
|
||||
assert_eq!(mods.len(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scan_mods_enabled_disabled_flags() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
|
||||
+4
-17
@@ -357,22 +357,9 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn maven_invalid_too_few_parts() {
|
||||
assert_eq!(maven_coord_to_path("org.example:artifact"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn maven_invalid_too_many_parts() {
|
||||
assert_eq!(maven_coord_to_path("a:b:c:d:e"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn maven_invalid_single_part() {
|
||||
assert_eq!(maven_coord_to_path("just-a-string"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn maven_empty_string() {
|
||||
assert_eq!(maven_coord_to_path(""), None);
|
||||
fn maven_invalid_coordinates() {
|
||||
for coordinate in ["org.example:artifact", "a:b:c:d:e", "just-a-string", ""] {
|
||||
assert_eq!(maven_coord_to_path(coordinate), None);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,15 +32,6 @@ fn shaders_missing_dir_returns_empty() {
|
||||
assert!(scan_shaders(tmp.path(), "ghost").is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shaders_finds_zip_and_dir() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let dir = setup_subdir(tmp.path(), "inst", "shaderpacks");
|
||||
std::fs::write(dir.join("shader-a.zip"), ZIP_HEADER).unwrap();
|
||||
std::fs::create_dir(dir.join("shader-b")).unwrap();
|
||||
assert_eq!(scan_shaders(tmp.path(), "inst").len(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shaders_disabled_variants() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
@@ -81,15 +72,6 @@ fn worlds_missing_dir_returns_empty() {
|
||||
assert!(scan_worlds(tmp.path(), "ghost").is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn worlds_finds_directories() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let dir = setup_subdir(tmp.path(), "inst", "saves");
|
||||
std::fs::create_dir(dir.join("My World")).unwrap();
|
||||
std::fs::create_dir(dir.join("Creative")).unwrap();
|
||||
assert_eq!(scan_worlds(tmp.path(), "inst").len(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn worlds_ignores_files() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
@@ -143,15 +125,6 @@ fn resource_packs_missing_dir_returns_empty() {
|
||||
assert!(scan_resource_packs(tmp.path(), "ghost").is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resource_packs_finds_zips_and_dirs() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let dir = setup_subdir(tmp.path(), "inst", "resourcepacks");
|
||||
std::fs::write(dir.join("pack-a.zip"), ZIP_HEADER).unwrap();
|
||||
std::fs::create_dir(dir.join("pack-b")).unwrap();
|
||||
assert_eq!(scan_resource_packs(tmp.path(), "inst").len(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resource_packs_disabled_variants() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -278,31 +278,3 @@ async fn download_assets_writes_index_when_objects_is_empty() {
|
||||
serde_json::from_slice(&std::fs::read(&index_path).unwrap()).unwrap();
|
||||
assert!(body.get("objects").is_some());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn fetch_version_manifest_retries_5xx_and_succeeds() {
|
||||
let server = MockServer::start().await;
|
||||
|
||||
// one transient 503 then the real payload; covers the integration of the
|
||||
// retry envelope (already unit-tested in net_retry.rs) with the actual
|
||||
// VersionManifest deserialisation path.
|
||||
Mock::given(method("GET"))
|
||||
.and(path("/manifest.json"))
|
||||
.respond_with(ResponseTemplate::new(503))
|
||||
.up_to_n_times(1)
|
||||
.expect(1)
|
||||
.mount(&server)
|
||||
.await;
|
||||
Mock::given(method("GET"))
|
||||
.and(path("/manifest.json"))
|
||||
.respond_with(ResponseTemplate::new(200).set_body_json(synthetic_manifest()))
|
||||
.expect(1)
|
||||
.mount(&server)
|
||||
.await;
|
||||
|
||||
let url = format!("{}/manifest.json", server.uri());
|
||||
let manifest = fetch_version_manifest_from(&HttpClient::new(), &url)
|
||||
.await
|
||||
.expect("manifest after retry");
|
||||
assert_eq!(manifest.versions.len(), 2);
|
||||
}
|
||||
@@ -32,16 +32,6 @@ fn scan_screenshots_missing_dir_returns_empty() {
|
||||
assert!(screenshots.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scan_screenshots_finds_images() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let dir = setup_screenshots_dir(tmp.path(), "inst");
|
||||
std::fs::write(dir.join("2024-01-01.png"), tiny_png()).unwrap();
|
||||
std::fs::write(dir.join("2024-01-02.png"), tiny_png()).unwrap();
|
||||
let screenshots = scan_screenshots(tmp.path(), "inst");
|
||||
assert_eq!(screenshots.len(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scan_screenshots_ignores_non_images() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
// verifies the lib/main split worked: integration tests can see crate items
|
||||
// through the public API.
|
||||
|
||||
#[test]
|
||||
fn lib_target_is_importable() {
|
||||
// touch one pure function from each major module so the linker fails if
|
||||
// any module went private by mistake during the split.
|
||||
assert!(rmcl::net::maven_coord_to_path("a:b:1.0").is_some());
|
||||
let _ = rmcl::config::SETTINGS.paths.effective_java_path();
|
||||
}
|
||||
Reference in new issue
Block a user