diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-04-03 21:34:20 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-04-03 21:34:20 +0300 |
| commit | ecf8b08595580e8a07fc4cf85e4800b1c1213cf3 (patch) | |
| tree | b915a50458dbfda9c60c28b32cca27f03abbd3b7 /src/update.rs | |
| parent | 05d6c6c2cd44c7db80c708c0e521ac4ac7e78e13 (diff) | |
feat: improve update-ready and release notes ux
Diffstat (limited to 'src/update.rs')
| -rw-r--r-- | src/update.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/update.rs b/src/update.rs index d616ace8..27e180a1 100644 --- a/src/update.rs +++ b/src/update.rs @@ -14,6 +14,12 @@ const GITHUB_REPO: &str = "ogulcancelik/herdr"; const CURRENT_VERSION: &str = env!("CARGO_PKG_VERSION"); const FAKE_UPDATE_VERSION_ENV: &str = "HERDR_FAKE_UPDATE_VERSION"; +fn fake_release_notes_body(version: &str) -> String { + format!( + "### Changed\n- Test update v{version} for local UI validation.\n\n### Notes\n- This is stub release-notes content generated by {FAKE_UPDATE_VERSION_ENV}." + ) +} + // --------------------------------------------------------------------------- // Version // --------------------------------------------------------------------------- @@ -231,6 +237,11 @@ pub fn auto_update(events: tokio::sync::mpsc::Sender<crate::events::AppEvent>) { version, "using fake update version for local testing" ); + if let Err(e) = + crate::release_notes::save_pending(version, &fake_release_notes_body(version)) + { + tracing::warn!("failed to save fake pending release notes: {e}"); + } let _ = events.blocking_send(crate::events::AppEvent::UpdateReady { version: version.to_string(), }); @@ -335,6 +346,14 @@ mod tests { } #[test] + fn fake_release_notes_include_version_and_context() { + let body = fake_release_notes_body("9.4.9"); + assert!(body.contains("v9.4.9")); + assert!(body.contains("local UI validation")); + assert!(body.contains(FAKE_UPDATE_VERSION_ENV)); + } + + #[test] fn version_ordering() { let v010 = Version::parse("0.1.0").unwrap(); let v011 = Version::parse("0.1.1").unwrap(); |
