test: persistence e2e and registration-relogin e2e; lint clean

Adds a lib target (soulseek_rs_tui) exposing cli/models/persist so
integration tests can drive the persistence pipeline: state and config
survive a simulated restart through the real files, with the incomplete
download flagged for auto-resume. The lib e2e suite gains a
register-then-relogin test against soulfind proving the stored-credential
flow's server assumptions. cargo clippy --all-targets and cargo fmt are
clean.
This commit is contained in:
michel
2026-07-20 20:20:54 +02:00
parent c945bd5d5e
commit 36819d4c42
14 changed files with 203 additions and 66 deletions
+5 -10
View File
@@ -29,7 +29,8 @@ pub struct StateStore {
}
impl StateStore {
pub fn new(dir: PathBuf) -> Self {
#[must_use]
pub const fn new(dir: PathBuf) -> Self {
Self { dir }
}
@@ -198,9 +199,7 @@ mod tests {
fn migrations_upgrade_old_data() {
// Machinery test with a synthetic chain: v0 stored plain strings,
// v1 wraps each in an object {"name": ...}.
#[derive(
Debug, PartialEq, Default, Serialize, serde::Deserialize,
)]
#[derive(Debug, PartialEq, Default, Serialize, serde::Deserialize)]
struct Named {
name: String,
}
@@ -216,15 +215,11 @@ mod tests {
}];
let tmp = tempfile::tempdir().unwrap();
let path = tmp.path().join("things.json");
std::fs::write(&path, r#"{"version": 0, "data": ["a", "b"]}"#)
.unwrap();
std::fs::write(&path, r#"{"version": 0, "data": ["a", "b"]}"#).unwrap();
let loaded: Vec<Named> = load(&path, chain);
assert_eq!(
loaded,
vec![
Named { name: "a".into() },
Named { name: "b".into() }
]
vec![Named { name: "a".into() }, Named { name: "b".into() }]
);
}