docs: catch up handoff and changelog
Build and Deploy / build-and-push (push) Successful in 5m23s

This commit is contained in:
funman300
2026-06-08 19:03:40 -07:00
parent 6193d31497
commit 7fe6ac6c1c
5 changed files with 442 additions and 52 deletions
+58
View File
@@ -204,3 +204,61 @@ fn mode_str(mode: GameMode) -> &'static str {
GameMode::Difficulty(_) => "difficulty",
}
}
#[cfg(test)]
mod tests {
use solitaire_core::game_state::DifficultyLevel;
use super::*;
#[test]
fn client_for_requires_analytics_opt_in() {
let settings = Settings {
analytics_enabled: false,
matomo_url: Some("https://analytics.example.com".into()),
..Settings::default()
};
assert!(client_for(&settings).is_none());
}
#[test]
fn client_for_requires_matomo_url() {
let settings = Settings {
analytics_enabled: true,
matomo_url: None,
..Settings::default()
};
assert!(client_for(&settings).is_none());
}
#[test]
fn client_for_creates_client_when_enabled_and_configured() {
let settings = Settings {
analytics_enabled: true,
matomo_url: Some("https://analytics.example.com".into()),
matomo_site_id: 2,
sync_backend: SyncBackend::SolitaireServer {
url: "https://solitaire.example.com".into(),
username: "alice".into(),
avatar_url: None,
},
..Settings::default()
};
assert!(client_for(&settings).is_some());
}
#[test]
fn mode_labels_match_analytics_payload_contract() {
assert_eq!(mode_str(GameMode::Classic), "classic");
assert_eq!(mode_str(GameMode::Zen), "zen");
assert_eq!(mode_str(GameMode::Challenge), "challenge");
assert_eq!(mode_str(GameMode::TimeAttack), "time_attack");
assert_eq!(
mode_str(GameMode::Difficulty(DifficultyLevel::Grandmaster)),
"difficulty"
);
}
}