test(nightly): preserve startup and saved session coverage (#1950)

This commit is contained in:
Dylan M. Taylor
2026-11-29 15:12:24 -05:00
committed by GitHub
parent 40497d7eca
commit 7b4905c00e
+26 -12
View File
@@ -201,14 +201,18 @@ mod tests {
let plain = parse_startup(BuildFlavor::NightlyV1, &spec, args(&[flag]), &StartupOptions::new()).unwrap();
assert!(plain.is_version_query());
let launcher = parse_startup(
BuildFlavor::NightlyV1,
&spec,
args(&["--launch-profile", NIGHTLY_V1_CONTRACT, "--profile-root", absolute(), flag]),
&StartupOptions::new(),
)
.unwrap();
assert!(launcher.is_version_query());
for header in [
["--launch-profile", NIGHTLY_V1_CONTRACT, "--profile-root", absolute()],
["--profile-root", absolute(), "--launch-profile", NIGHTLY_V1_CONTRACT],
] {
let mut query = args(&header);
query.push(flag.into());
assert!(parse_startup(BuildFlavor::NightlyV1, &spec, query.clone(), &StartupOptions::new()).unwrap().is_version_query());
query.push("recording with spaces.wav".into());
let launch = parse_startup(BuildFlavor::NightlyV1, &spec, query, &StartupOptions::new()).unwrap();
assert!(!launch.is_version_query());
assert_eq!(launch.passthrough_args, args(&[flag, "recording with spaces.wav"]));
}
}
}
@@ -229,10 +233,20 @@ mod tests {
}
assert_eq!(validate_and_prepare_root(&root, &spec).unwrap(), prepared);
let autosave = prepared.join("Autosave");
std::fs::remove_dir(&autosave).unwrap();
std::fs::write(&autosave, b"not a directory").unwrap();
assert!(matches!(validate_and_prepare_root(&root, &spec), Err(ProfileError::ExpectedDirectoryEntry(_))));
for file in ["ui.json", "nightly-session.lock", "nightly-session.json"] {
assert_eq!(std::fs::read(prepared.join(file)).unwrap(), b"saved profile data", "{file} remains intact after reopen");
}
for folder in FOLDER_ONLY_ENTRIES {
let path = prepared.join(folder);
std::fs::remove_dir(&path).unwrap();
std::fs::write(&path, b"not a directory").unwrap();
assert!(
matches!(validate_and_prepare_root(&root, &spec), Err(ProfileError::ExpectedDirectoryEntry(_))),
"{folder} must remain a directory"
);
std::fs::remove_file(&path).unwrap();
std::fs::create_dir(&path).unwrap();
}
}
#[test]