// Lock file behavior is tested via unit tests in src/volume.rs.
// Integration-level: verify that a fresh save_and_set_max() call creates the lock file.
// (pactl/osascript may not be available in CI — volume operations are best-effort.)

#[test]
fn save_and_set_max_creates_lock_file() {
    // Override XDG_RUNTIME_DIR so we use a temp path, not the real user's runtime dir.
    let dir = tempfile::tempdir().unwrap();
    std::env::set_var("XDG_RUNTIME_DIR", dir.path());

    let result = ahfail_ui::volume::save_and_set_max();
    // Should succeed (lock file didn't exist).
    assert!(result.is_some());
    assert!(dir.path().join("ahfail.lock").exists());

    // Cleanup: restore() removes the lock file.
    ahfail_ui::volume::restore(result.unwrap());
    assert!(!dir.path().join("ahfail.lock").exists());
}
