test(peer): cover installed-only rescan readiness
Add a focused local-library test for the case where a game starts with only a committed `local/` install and later gains a root `version.ini` sentinel. The single-game rescan now has coverage showing it promotes the summary from LocalOnly to Ready while preserving the installed flag and reading the local version. This pins the cached-index transition called out in FOLLOW_UP_2.md without touching scanner dispatch or broader monitor behavior. Test Plan: - git diff --check - just fmt - just clippy - just test Follow-up-Plan: FOLLOW_UP_2.md
This commit is contained in:
@@ -716,6 +716,39 @@ mod tests {
|
|||||||
assert!(!scan.summaries.contains_key("non-catalog"));
|
assert!(!scan.summaries.contains_key("non-catalog"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn rescan_promotes_installed_only_game_to_ready_when_sentinel_appears() {
|
||||||
|
let temp = TempDir::new();
|
||||||
|
let catalog = HashSet::from(["game".to_string()]);
|
||||||
|
std::fs::create_dir_all(temp.path().join("game").join("local"))
|
||||||
|
.expect("local install dir should be created");
|
||||||
|
|
||||||
|
let first_scan = scan_local_library(temp.path(), &catalog)
|
||||||
|
.await
|
||||||
|
.expect("initial scan should succeed");
|
||||||
|
let local_only = first_scan
|
||||||
|
.summaries
|
||||||
|
.get("game")
|
||||||
|
.expect("installed-only game should be indexed");
|
||||||
|
assert!(!local_only.downloaded);
|
||||||
|
assert!(local_only.installed);
|
||||||
|
assert_eq!(local_only.availability, Availability::LocalOnly);
|
||||||
|
|
||||||
|
write_file(&temp.path().join("game").join("version.ini"), b"20250101");
|
||||||
|
|
||||||
|
let rescan = rescan_local_game(temp.path(), &catalog, "game")
|
||||||
|
.await
|
||||||
|
.expect("rescan should succeed");
|
||||||
|
let ready = rescan
|
||||||
|
.summaries
|
||||||
|
.get("game")
|
||||||
|
.expect("ready game should remain indexed");
|
||||||
|
assert!(ready.downloaded);
|
||||||
|
assert!(ready.installed);
|
||||||
|
assert_eq!(ready.eti_version.as_deref(), Some("20250101"));
|
||||||
|
assert_eq!(ready.availability, Availability::Ready);
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn local_download_available_gates_on_catalog_operation_and_sentinel() {
|
async fn local_download_available_gates_on_catalog_operation_and_sentinel() {
|
||||||
let temp = TempDir::new();
|
let temp = TempDir::new();
|
||||||
|
|||||||
Reference in New Issue
Block a user